All tags
Relative Sort Array
Given two arrays arr1 and arr2, the elements of arr2 are distinct, and all elements in arr2 are also in arr1.
Roman to Integer
Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.
Unique Paths
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).
Defanging an Ip Address
Given a valid (IPv4) IP address, return a defanged version of that IP address.
Maximum Depth of N Ary Tree
Given a n-ary tree, find its maximum depth.
Partition to K Equal Sum Subsets
Given an array of integers nums and a positive integer k, find whether it's possible to divide this array into k non-empty subsets whose sums are all equal.
Prison Cells After N Days
There are 8 prison cells in a row, and each cell is either occupied or vacant.
Maximum Gap
Given an unsorted array, find the maximum difference between the successive elements in its sorted form.
Sort Colors
Given an array with n objects colored red, white or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white and blue.
Binary Search
Given a sorted (in ascending order) integer array nums of n elements and a target value, write a function to search target in nums.
Add Strings
Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2.
Best Time to Buy and Sell Stock II
Say you have an array for which the ith element is the price of a given stock on day i.
Design an algorithm to find the maximum profit. You may complete as many transactions as you like (i.e., buy one and sell one share of the stock multiple times).