hard-problems

Find Index of zero to be replaced to get maximum length of consecutive ones

Given an array containing only zeros and ones, find the index of zero to be replaced with one to get the maximum length of consecutive ones. Test Case Example Input : 1 0 0 1 0 1Sample Output: 4 Test Case Explanation If we replace zero located at index 1, the maximum length of consecutive1s …

Find Index of zero to be replaced to get maximum length of consecutive ones Read More »

Longest Repeating Character Replacement | Sliding Window

Longest Repeating Character Replacement Given a string s that consists of only uppercase English letters, you can perform at most k operations on that string. In one operation, you can choose any character of the string and change it to any other uppercase English character. Find the length of the longest sub-string containing all repeating …

Longest Repeating Character Replacement | Sliding Window Read More »

Finding kth smallest element in a sorted matrix

Problem Statement Given a sorted matrix of size n*n and a number k. Find the kth smallest element in the matrix. The matrix can contain duplicates. A sorted matrix is a matrix in which each row and each column is sorted. Example Test Case Given Matrix: 1 2 3 3 5 9 7 7 10 …

Finding kth smallest element in a sorted matrix Read More »

Scroll to Top
[gravityforms id="5" description="false" titla="false" ajax="true"]