原创 Isomorphic Strings
Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be r
原创 Contains Duplicate
Given an array of integers, find if the array contains any duplicates. Your function should return true if any value ap
原创 Compare Version Numbers
Compare two version numbers version1 and version2. If version1 > version2 return 1, if version1 < version2 return -1, o
原创 Rotate Array
Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is
原创 數據結構——散列表
什麼是散列表 散列表也叫做哈希表(hash table),這種數據結構提供了鍵和值的映射關係。根據key可以快速的查找他所匹配的value,時間複雜度接近於O(1)。 散列表的實現 散列表本質上就是一個數組,這
原创 Min Stack
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push eleme
原创 Reverse Bits
Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 000000101
原创 Contains Duplicate II
Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such
原创 Excel Sheet Column Number
Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its corresponding
原创 Excel Sheet Column Title
Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: 1 -> A
原创 Intersection of Two Linked Lists
Write a program to find the node at which the intersection of two singly linked lists begins. For example, the followin
原创 Implement Stack using Queues
Implement the following operations of a stack using queues. push(x) -- Push element x onto stack.pop() -- Removes the e
原创 Number of 1 Bits
Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming w
原创 Happy Number
Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: St
原创 Rectangle Area
Find the total area covered by two rectilinear rectangles in a 2D plane. Each rectangle is defined by its bottom left c