Positions of Large Groups | String Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given a string S of lowercase letters, these letters form consecutive groups of the same character. For example, a string like S = “abbcccczyyy” has the groups “a”, “bb”, “cccc”, “z” and “yyy”. If a group has 3 or more characters, then this group is called as large group. Write a program to find Read More

Maximum Subarray | Array Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given an array of integers, write a program to find out the contiguous subarray (containing at least one number) having the largest sum. Example  Input :- Output :- 13 Input :- Output :- Read More

Rotate Array | Array Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given array and an integer K. Write a program to rotate the array to the right by K steps. Example  Input :- and K = 4 Output :- Input :- Read More

Find Pivot Index in Array | Array Problem

4 years ago Lalit Bhagtani 0
Problem Statement Pivot index is defined as an index whose sum of the numbers to the left is equal to the sum of the numbers to the right. You have given an array of integers. Write a program to return the pivot index of the given input array if no such index exists, then return Read More

Move Zeroes to End of Array | Array Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given an array of integers, write a program to move all 0 to the end of the array while maintaining the relative order of the non zero elements. Note: Implement with O(1) space complexity (in-place) Example  Input :- Output :- Read More

Day of the Week | Algorithm & Data Structure

4 years ago Lalit Bhagtani 0
Problem Statement You have given a date, write a program to return the corresponding day of the week for that date. The input date is given as three integers representing the day, month and year respectively. Return the answer as one of the following values {“Sunday”, “Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saturday”}. Example  Input :- Read More

Height Checker | Array Problem | LeetCode 1051

4 years ago Lalit Bhagtani 0
Problem Statement Students are asked to stand in non-decreasing order of their heights for an annual photo. Write a program to find out the minimum number of students that are not standing in the right positions. This is the number of students that must move in order for all students to be standing in a Read More

Find Words That Can Be Formed by Characters | Array Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given an array of words and a string S. A word is good if it can be formed by using characters from string S (each character can only be used once). Write a program to find out the sum of the length of all good words in the given array. Example  Read More

Single Row Keyboard | String Problem | LeetCode 1165

4 years ago Lalit Bhagtani 0
Problem Statement There is a special keyboard with all keys in a single row. You have given a string keyboard of length 26 indicating the layout of the keyboard (indexed from 0 to 25), initially your finger is at index 0. To type a character, you have to move your finger to the index of Read More

Alphabet Board Path | String Problem | LeetCode 1138

4 years ago Lalit Bhagtani 0
Problem Statement You have given an alphabet board, board = , as shown in the diagram below. On an alphabet board, you start at a position (0, 0), corresponding to character board and you can take only the following moves: ‘U’ moves your position up one row, if the position Read More