Array

­

FIxed Size Array

Introduce fixed size array

November 13th, 2015|Categories: Array, DS and Algorithms|Tags: , |

Dynamically Resizing Array

A dynamically resizing array is an array that resizes itself as needed

November 13th, 2015|Categories: Array, DS and Algorithms|Tags: , |

[Leetcode] Rotate Array

Rotate an array of n elements to the right by k steps.

November 14th, 2015|Categories: Array, DS and Algorithms|Tags: , , , |

[Leetcode] Plus One

Given a non-negative number represented as an array of digits, plus one to the number.

November 14th, 2015|Categories: Array, DS and Algorithms, Math|Tags: , , , , |

[Leetcode] 3Sum

Given an array S of n integers, find there elements a, b, c in S such that a + b + c = 0.

November 14th, 2015|Categories: Array, DS and Algorithms|Tags: , , , , |

[Leetcode] 3Sum closest

Given an array S of n integers, find three integers in S such that the sum is closest to a given number.

November 14th, 2015|Categories: Array, DS and Algorithms|Tags: , , , , |

[Leetcode] Remove Element

Given an array and a value, remove all instances of that value in place and return the new length.

November 14th, 2015|Categories: Array, DS and Algorithms|Tags: , , , |

[Leetcode] Remove Duplicates from Sorted Array

Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.

November 14th, 2015|Categories: Array, DS and Algorithms|Tags: , , , , |

[Leetcode] Generate Parentheses

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.

November 14th, 2015|Categories: Array, DS and Algorithms|Tags: , , , |

[Leetcode] Spiral Matrix

Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.

November 14th, 2015|Categories: Array, DS and Algorithms|Tags: , , , |

[Leetcode] Spiral Matrix II

Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.

November 14th, 2015|Categories: Array, DS and Algorithms|Tags: , , , |

[Leetcode] Triangle

Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.

November 14th, 2015|Categories: Array, DS and Algorithms, Dynamic Programming|Tags: , , , |

[Leetcode] Merge Sorted Array

Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.

November 14th, 2015|Categories: Array, DS and Algorithms|Tags: , , , |

[Leetcode] Pascal’s Triangle

Given numRows, generate the first numRows of Pascal's triangle.

November 14th, 2015|Categories: Array, DS and Algorithms|Tags: , , , |

[Leetcode] Pascal’s Triangle II

Given an index k, return the kth row of the Pascal's triangle.

November 14th, 2015|Categories: Array, DS and Algorithms|Tags: , , , |

[Leetcode] Subsets

Given a set of distinct integers, nums, return all possible subsets.

November 14th, 2015|Categories: Array, DS and Algorithms, Recursion|Tags: , , , , , |

[Leetcode] Subsets II

Given a collection of integers that might contain duplicates, nums, return all possible subsets.

November 14th, 2015|Categories: Array, DS and Algorithms, Recursion|Tags: , , , , , |

[Leetcode] Combination Sum III

Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used.

November 29th, 2015|Categories: Array, DS and Algorithms, Recursion, Searching|Tags: , , , , |

[Leetcode] Search a 2D Matrix

Write an efficient algorithm that searches for a value in an m x n matrix.

November 14th, 2015|Categories: Array, DS and Algorithms, Searching|Tags: , , , , |

[Leetcode] Search a 2D Matrix II

Write an efficient algorithm that searches for a value in an m x n matrix.

November 14th, 2015|Categories: Array, DS and Algorithms, Searching|Tags: , , , |

[Leetcode] Set Matrix Zeroes

Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.

November 17th, 2015|Categories: Array, DS and Algorithms|Tags: , , , |

[Leetcode] Summary Ranges

Given a sorted integer array without duplicates, return the summary of its ranges.

November 14th, 2015|Categories: Array, DS and Algorithms, String|Tags: , , , |

[Leetcode] Minimum Size Subarray Sum

Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of [...]

December 1st, 2015|Categories: Array, DS and Algorithms|Tags: , , , , |

[Leetcode] ZigZag Conversion

Convert a string to the ZigZag pattern

December 4th, 2015|Categories: Array, DS and Algorithms, String|Tags: , , , |

[Leetcode] Move Zeroes

Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.

December 5th, 2015|Categories: Array, DS and Algorithms|Tags: , , , , |

[Leetcode] Container With Most Water

Find two vertical lines which form a container with x-axis , such that the container contains the most water.

December 5th, 2015|Categories: Array, DS and Algorithms|Tags: , , , , |

[Leetcode] Majority Element

Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.

December 7th, 2015|Categories: Array, DS and Algorithms, Hash, Sorting|Tags: , , , , |

[Leetcode] Range Sum Query Immutable

Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.

December 11th, 2015|Categories: Array, DS and Algorithms, Dynamic Programming|Tags: , , , |

[Leetcode] Best Time to Buy and Sell Stock

Given 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 if you were only permitted to complete at most one transaction.

December 12th, 2015|Categories: Array, DS and Algorithms, Dynamic Programming|Tags: , , , |

[Leetcode] Best Time to Buy and Sell Stock II

Given 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 if you may complete as many transactions as you like.

December 13th, 2015|Categories: Array, DS and Algorithms, Dynamic Programming|Tags: , , , , |