The “Square Root using Binary Search” problem is a classic question that helps you understand both brute force and binary…
Browsing: Easy
The GeeksforGeeks problem “Sum of first n terms” asks you to compute the value of and return the result. All…
The “Print N to 1 without loop” problem on GeeksforGeeks challenges you to output the integers from N down to…
A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself.Formally,…
You are given an array prices where prices[i] is the price of a given stock on the ith day. You want to maximize your profit by…
Explore the Maximum Subarray problem with a brute-force triple loop, a quadratic improvement, and the optimal Kadane’s Algorithm, all with…
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may…
Given an array nums containing n distinct numbers in the range [0, n], return the only number in the range that is missing from the array.…
Given two sorted arrays a[] and b[], where each array may contain duplicate elements , the task is to return the elements in the union of the two arrays…
Learn a one-pass way to check if array is sorted in non-decreasing order. Intuition, commented Python code, dry run, and…