704. Binary Search Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to search ta
You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality c
leetcode.35Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it wo
You are climbing a staircase. It takes n steps to reach the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb t
You are given an integer array cost where cost\[i] is the cost of i^th step on a staircase. Once you pay the cost, you can either climb one or two ste
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 assume that each inpu
You are given two integer arrays nums1 and nums2, sorte in non-decreasing order, and two integers m and n, representing the number of elements in nums
Given an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order.Input : nums
Given an array, rotate the arrya to the right by k steps, where k is non-negative.Input : nums = 1,2,3,4,5,6,7, k = 3Output : 5,6,7,1,2,3,4Explanation
Given an integer array nums, move all 0's to the end of it while maintaining the relative order of the non-zero elements.Note that you must do this in
Given a 1-indexed array of integers numbers that is already sorted in non-decreasing order, find two numbers such that they add up to a specific targe
Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must appear as many times as it shows in b
You are given an array prices where prices\[i] is the price of a given stock on the i^th day.You want to maximize your profit by choosing a single day
You are aprofessional robber planning to rob houses along a street. Each house has a certain amout of moeny stashed, the only constraint stopping you
213. House Robber II Problem You are professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All
Write a function that reverses a string. The input string is given as an array of characters s.You must do this by modifying the input array in-place
Given a string s, reverse the order of characters in each word within a sentence while still preserving whitepace and initial word order.Input: s = "L
Given the head of singly linked list, return the middle node of the linked list.If there are two middel nodes, return the second middle node.Input : h
You are given an integer array nums. You are initially positioned at the array's first index, and each element in the array represents your maximum ju
In MATLAB, there is a handy function called reshape which can reshape an mxn matrix into a new one with a different size rxc keeping its original data
Given an intenger numRows, return the first numRows of Pascal's triangle.In Pascal's triangle, each number is the sum of the two numbers directly abov
Determine if a 9x9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules:1\. Each row must contain the di
Write an efficeint algorithm that searches for a value target in an mxn integer matrix matrix. This matrix has the following properties:Integers in ea