Rafiul Hasanrafiulhasan.rocks·Feb 26, 2024Kth Smallest Element in a Row-wise and Column-wise Sorted MatrixProblem Link: LeetCode We are given a matrix in which the rows are sorted, and columns are sorted. WE have to find the kth smallest element in the matrix. There are many approaches. Applying Binary Search is one of them. Its time complexity is bit be...Discussleetcode

Ritwik Mathritwikmath.hashnode.dev·Feb 17, 2024Binary Search in PythonBinary Search: The concept of binary search is like finding a word in a dictionary. Imagine you're looking for a particular word, and the dictionary is sorted alphabetically. Initial Guess: You open the dictionary roughly in the middle and check the...Discussritwikmath

Gulshan Kumarperfinsights.hashnode.dev·Feb 1, 2024Binary SearchGiven an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums. If target exists, then return its index. Otherwise, return -1. You must write an algorithm with O(log n) runtime com...DiscussJava Solutionarray

Gulshan Kumarperfinsights.hashnode.dev·Feb 1, 2024Find Target Indices After Sorting ArrayYou are given a 0-indexed integer array nums and a target element target. A target index is an index i such that nums[i] == target. Return a list of the target indices of nums after sorting nums in non-decreasing order. If there are no target indices...DiscussJava Solutionarray

Gulshan Kumarperfinsights.hashnode.dev·Feb 1, 2024Find Smallest Letter Greater Than TargetYou are given an array of characters letters that is sorted in non-decreasing order, and a character target. There are at least two different characters in letters. Return the smallest character in letters that is lexicographically greater than targe...DiscussJava SolutionBinary Search Algorithm

Gulshan Kumarperfinsights.hashnode.dev·Feb 1, 2024Minimum Common ValueGiven two integer arrays nums1 and nums2, sorted in non-decreasing order, return the minimum integer common to both arrays. If there is no common integer amongst nums1 and nums2, return -1. Note that an integer is said to be common to nums1 and nums2...DiscussJava Solutionarray

Gulshan Kumarperfinsights.hashnode.dev·Feb 1, 2024Valid Perfect SquareGiven a positive integer num, return true if num is a perfect square or false otherwise. A perfect square is an integer that is the square of an integer. In other words, it is the product of some integer with itself. You must not use any built-in lib...DiscussJava SolutionJava

Piyush Agrawalpiyushagrawal.hashnode.dev·Jan 31, 2024Book Allocation Promblem in Binary searchProblem Statement: Given an array of books, where each book has a certain number of pages, and a number of students, you need to allocate books in a way that minimizes the maximum number of pages assigned to a student. Each student must be allocated ...DiscussBinary Search Algorithm

Gulshan Kumarperfinsights.hashnode.dev·Jan 20, 2024Find Peak ElementA peak element is an element that is strictly greater than its neighbors. Given a 0-indexed integer array nums, find a peak element, and return its index. If the array contains multiple peaks, return the index to any of the peaks. You may imagine tha...DiscussJava Solutionarray

Gulshan Kumarperfinsights.hashnode.dev·Jan 20, 2024Guess Number Higher or LowerWe are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to guess which number I picked. Every time you guess wrong, I will tell you whether the number I picked is higher or lower than your guess. You call a pre-de...DiscussJava SolutionBinary Search Algorithm