newszine

Search Insert Position | Search Problem | LeetCode 35

4 years ago Lalit Bhagtani 0
Problem Statement You have given a sorted array and a target value, write a program to search the target value in the sorted array. If the target value is found, then return its index otherwise return the index where it would be present if it is inserted in the sorted array. Note: Array contains no Read More

Max Consecutive Ones | Array Problem | LeetCode 485

4 years ago Lalit Bhagtani 0
Problem Statement You have given an integer array comprising of 1 and 0 integers only, write a program to find out the maximum number of consecutive 1’s in the given array. Example  Input :- Output :- 3 Input :- Output :- Read More

Check if Coordinates make a Straight Line | Array Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given an array of coordinates, write a program to find out if an array of coordinates make a straight line in the 2D plane. Each coordinate is an array of two values x and y, where x represents a coordinate point on X-axis and y represents the coordinate point on Y-axis Read More

Relative Ranks | Array Problem | LeetCode 506

4 years ago Lalit Bhagtani 0
Problem Statement You have given a scores of N athletes, write a program to find out their relative ranks. Athletes with the top three highest scores will be awarded medals: “Gold Medal“, “Silver Medal“, “Bronze Medal“. Example  Input :- Output :- Gold Medal, Silver Medal, Bronze Medal, 4, 5, Input Read More

Transpose Matrix | Array Problem

4 years ago Lalit Bhagtani 0
Problem Statement The transpose of a matrix is a new matrix whose rows are the columns of the original matrix. You have given a matrix A, write a program to return the transpose of given matrix A. Example  Input :- , , ] Output :- , Read More

Peak Index in a Mountain Array | Array Problem

4 years ago Lalit Bhagtani 0
Problem Statement An array A is a mountain array, if the following properties hold true: Length of an array is greater than equal to 3 (A.length >= 3). Only one peak element exist in the array. Peak element at index i follows (A < A < … A < A > A > … > Read More

Find Peak Element in Array | Array Problem

4 years ago Lalit Bhagtani 0
Problem Statement A peak element is an element, which is greater than its neighbors. You have given an array of integers N, where N != N, Write a program to find out the peak element in the given array and return its index. In the case of multiple peaks, return the index of any one Read More

Duplicate Zeros in Array | Array Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given an array of integers, duplicate each occurrence of zero and shift the remaining elements to the right. Elements beyond the length of the array are dropped (not written). Note: Implement this with modifications in input array only. Example  Input :- Output Read More

Find Common Characters in Array of Strings | Array Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given an array of strings (lowercase characters only), write a program to return a list of all characters (including duplicates) which is present in all strings of an array. For example, if a character occurs 3 times in all strings, then include that character three times in the result. Example  Input Read More

Find the Duplicate Number in Array | Array Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given an array N, containing n + 1 integer elements, where each integer element is between 1 (inclusive) and n (inclusive). Write a program to return the duplicate integer. Note: Integer array N contains only one duplicate integer. Example  Input :- Output :- 3 Read More