Vanshika Sood has Published 28 Articles

First Occurrence of a Digit in a Given Fraction

Vanshika Sood

Vanshika Sood

Updated on 08-Sep-2023 11:11:02

71 Views

The decimal expansion of a fraction is the decimal representation of the fraction's value. In the following article we discuss two approaches to find the first occurrence of c in a/b. Problem Statement Given three integers a, b, c, locate the first instance of c in the fraction a/b after ... Read More

Minimize the Absolute Difference of Sum of Two Subsets

Vanshika Sood

Vanshika Sood

Updated on 08-Sep-2023 11:06:08

227 Views

To Minimize the Absolute Difference of Sum of Two Subsets, we partition a vector into two subsets i.e. we divide the elements of the vector into two smaller vectors such that each element of the original vector belongs to one of the two smaller vectors, and the two smaller vectors ... Read More

Nearest power of 2 of frequencies of each digit of a given number

Vanshika Sood

Vanshika Sood

Updated on 27-Aug-2023 11:39:30

59 Views

The article describes a method to calculate the closest power of 2 for the frequency of each digit in a given number. The term "frequencies" refers to the count of occurrences of each unique digit in the number. Problem Statement Determine the occurrence count of each digit in ... Read More

Maximize count of occurrences of S2 in S1 as a subsequence by concatenating N1 and N2 times respectively

Vanshika Sood

Vanshika Sood

Updated on 27-Aug-2023 11:35:53

116 Views

The following article discusses an approach to count the maximum occurrences of a string s2 in another string s1 after they have been concatenated N1 and N2 times respectively. This is an interesting type of pattern searching problem. In this article we have employed a relatively intuitive solution approach. ... Read More

Lexicographically smallest string with period K possible by replacing ‘?’s from a given string

Vanshika Sood

Vanshika Sood

Updated on 27-Aug-2023 11:24:27

235 Views

A string is a period of K if and only if it repeats itself every K characters. For example, the string "abcabcabc" is a period of 3, because it repeats itself every 3 characters. The string "abcabc?abc" is not a period of 3, because the character '?' does not repeat ... Read More

Lexicographically largest string possible by repeatedly appending first character of two given strings

Vanshika Sood

Vanshika Sood

Updated on 27-Aug-2023 10:07:19

158 Views

Lexicographic ordering refers to a method of comparing sequences of elements, akin to the ordering of words in a dictionary. The comparison process involves evaluating the first element of each sequence. If the first element of the first sequence is considered smaller than the first element of the second sequence, ... Read More

Count all prime numbers that can be formed using digits of a given number

Vanshika Sood

Vanshika Sood

Updated on 27-Aug-2023 09:57:29

187 Views

Any number larger than 1 is said to be prime if it cannot be written as the product of two smaller natural numbers except 1 and the number itself. For instance, 5 is prime since its only product forms, 1 5 and 5 1, both involve 5. Primes play a ... Read More

Calculate time required to type a word using given single-row keyboard

Vanshika Sood

Vanshika Sood

Updated on 27-Aug-2023 09:54:43

89 Views

The following article discusses an efficient approach to compute the total time taken to type out a word using a single-row keyboard. This is an interesting problem and has been asked previously in technical interviews. Problem Statement Consider a hypothetical scenario wherein all the keys on a keyboard ... Read More

Find Mth Eelement after K Right Rotations of an Array

Vanshika Sood

Vanshika Sood

Updated on 27-Aug-2023 09:52:00

52 Views

Right rotating an array means shifting its elements to the right by a certain number of positions. In a single right rotation, the last element of the array becomes the first element, and the remaining elements are shifted to the right. Problem Statement The goal is to ... Read More

Toggle First and Last Bits of a Number

Vanshika Sood

Vanshika Sood

Updated on 17-Aug-2023 20:02:03

432 Views

The following article provides an in depth explanation of the method used to modify a number by toggling its first and last bit using bitwise operators. A bitwise operator is an operator that can be used to manipulate individual bits in binary numbers or bit patterns. Problem Statement For a ... Read More

Advertisements