Jump search algorithm is a pretty new algorithm to search for an element in a sorted array. The idea of…
What is Knuth Morris Pratt or KMP algorithm ? KMP is an algorithm which is used in the applications of…
Binary Search is a Logarithmic search which finds the target element in a sorted array in O(logN) times compared to…
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only…
Given an input string (s) and a pattern (p), implement regular expression matching with support for '.' and '*'. '.' Matches any single…
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display…
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1->2->3 which…
Given a positive integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. Example: Input: 3 Output:…
Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. Example 1: Input: [ [ 1,…
Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its…
This website uses cookies.