Rafiul Hasanrafiulhasan.rocks·15 hours agoKth 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

Chetan Dattachetan77.hashnode.dev·a day ago704. Binary SearchProblem Given 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) run...DiscussLeetcodebinary search

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

Chetan Dattachetan77.hashnode.dev·Jan 16, 20244. Median of Two Sorted ArraysProblem Statement Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). (link) Example 1: Input: nums1 = [1,3], nums2 = [2] Output: 2....DiscussLeetcodeMedian of Two Sorted Arrays

Chetan Dattachetan77.hashnode.dev·Jan 2, 2024Allocate BooksProblem statement Given an array ‘arr’ of integer numbers, ‘arr[i]’ represents the number of pages in the ‘i-th’ book. There are ‘m’ number of students, and the task is to allocate all the books to the students.(link) Allocate books in such a way tha...DiscussLeetcodeallocate books

Chetan Dattachetan77.hashnode.dev·Dec 12, 2023162. Find Peak ElementProblem Statement A 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. Y...DiscussBinary Search Algorithm

Chetan Dattachetan77.hashnode.dev·Dec 11, 2023153. Find Minimum in Rotated Sorted ArrayProblem Statement Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,2,4,5,6,7] might become: [4,5,6,7,0,1,2] if it was rotated 4 times. [0,1,2,4,5,6,7] if it was rotated 7 ti...DiscussLeetcodebinary search

Chetan Dattachetan77.hashnode.dev·Dec 4, 202333 & 81 Search in Rotated Sorted ArraySearch in Rotated Sorted Array I Problem Statement There is an integer array nums sorted in ascending order (with distinct values) Given the array nums after the possible rotation and an integer target, return the index of target if it is in nums, or...Discusssearch-in-rotated-sorted-array

Kallol Bairagikallolbairagi.hashnode.dev·Oct 12, 2023#704.Binary Search [LeetCode Grind 75 in Java]class Solution { public int binarySearch(int[] nums, int target) { int left = 0; int right = nums.length - 1; while(left <= right){ int mid = left + (right - left) / 2; if(nums[mid] == target) ret...DiscussLeetCode Grind 75 in JavaDSA

Sean Coughlinblog.seancoughlin.me·Sep 5, 2023How to Find First and Last Position of Element in Sorted ArrayThe Problem With this article, I will be covering the Find First and Last Position of an Element in a Sorted Array problem. Leetcode describes the problem with the following: Given an array of integers nums sorted in non-decreasing order, find the s...Discuss·62 readsSWE Interview Preparationleetcode