Home
Gaurav's GitHub Page
Cancel

Game of Life

PROBLEM DESCRIPTION According to Wikipedia’s article: “The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970.” The b...

Contains Duplicate II

PROBLEM DESCRIPTION Given an integer array nums and an integer k, return true if there are two distinct indices i and j in the array such that nums[i] == nums[j] and abs(i - j) <= k. leetcode ...

Word Pattern

PROBLEM DESCRIPTION Given a pattern and a string s, find if s follows the same pattern. Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty w...

Isomorphic Strings

PROBLEM DESCRIPTION Given two strings s and t, determine if they are isomorphic. Two strings s and t are isomorphic if the characters in s can be replaced to get t. All occurrences of a character ...

Substring with Concatenation of All Words

PROBLEM DESCRIPTION You are given a string s and an array of strings words. All the strings of words are of the same length. A concatenated substring in s is a substring that contains all the stri...

Minimum Size Subarray Sum

PROBLEM DESCRIPTION Given an array of positive integers nums and a positive integer target, return the minimal length of a subarray whose sum is greater than or equal to target. If there is no suc...

Insert Delete GetRandom O(1)

PROBLEM DESCRIPTION Implement the RandomizedSet class: RandomizedSet() Initializes the RandomizedSet object. bool insert(int val) Inserts an item val into the set if not present. Returns tru...

ZigZag Conversion

PROBLEM DESCRIPTION The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P ...

Reverse Words in a String

PROBLEM DESCRIPTION Given an input string s, reverse the order of the words. A word is defined as a sequence of non-space characters. The words in s will be separated by at least one space. Return...

Length of Last Word

PROBLEM DESCRIPTION Given a string s consisting of words and spaces, return the length of the last word in the string. A word is a maximal substring consisting of non-space characters only. leet...