­

Hash Table

A hash table is a data structure that maps keys to values for highly effient lookup.

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

[Leetcode] Contains Duplicate

Given an array of integers, find if the array contains any duplicates.

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

[Leetcode] Longest Substring Without Repeating Characters

Given a string, find the length of the longest substring without repeating characters.

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

[Leetcode] Contains Duplicate II

Find if a duplicate exists among the recent k numbers.

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

[Leetcode] Swap Nodes in Pairs

Given a linked list, swap every two adjacent nodes and return its head.

November 14th, 2015|Categories: DS and Algorithms, Hash, Linked List|Tags: , , , |

[Leetcode] Letter Combinations of a Phone Number

Given a digit string, return all possible letter combinations that the number could represent.

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

[Leetcode] Happy Number

Write an algorithm to determine if a number is "happy".

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

[Leetcode] Single Number

Given an array of integers, every element appears twice except for one. Find that single one.

November 23rd, 2015|Categories: Bit Manipulation, DS and Algorithms, Hash|Tags: , , , |

[Leetcode] Single Number II

Given an array of integers, every element appears three times except for one. Find that single one.

November 25th, 2015|Categories: Bit Manipulation, DS and Algorithms, Hash|Tags: , , , |

[Leetcode] Single Number III

Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once.

November 26th, 2015|Categories: Bit Manipulation, DS and Algorithms, Hash|Tags: , , |

[Leetcode] Repeated DNA Sequences

Write a function to find all the 10-letter-long sequences (substrings) that occur more than once in a DNA molecule.

November 29th, 2015|Categories: Bit Manipulation, DS and Algorithms, Hash|Tags: , , , |

[Leetcode] Add and Search Word – Data structure design

Design a data structure that supports add(word) and search(word).

December 1st, 2015|Categories: DS and Algorithms, Hash, Searching, Tree|Tags: , , , , , |

[Leetcode] Isomorphic Strings

Given two strings s and t, determine if they are isomorphic.

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

[Leetcode] Valid Anagram

Given two strings s and t, write a function to determine if t is an anagram of s.

December 7th, 2015|Categories: DS and Algorithms, Hash, String|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] Valid Sudoku

Given a sudoku, determine if it is valid.

December 10th, 2015|Categories: DS and Algorithms, Hash|Tags: , , , |

[Leetcode] Word Pattern

Given a pattern and a string str, find if str follows the same pattern.

December 11th, 2015|Categories: DS and Algorithms, Hash, String|Tags: , , , |

[Leetcode] Bulls and Cows

Bulls and Cows is an interesting problem that could be solved by hash table in an interesting way.

December 11th, 2015|Categories: DS and Algorithms, Hash, String|Tags: , , , |