Buttercola
Friday, August 28, 2015
Leetcode: Happy Number
›
Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting w...
Leetcode: Binary Tree Right Side View
›
Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bo...
Leetcode: Bitwise AND of Numbers Range
›
Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive. For exampl...
Leetcode: 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 weight ). For e...
Leetcode: Reverse Bits
›
Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010...
Thursday, August 27, 2015
Leetcode: 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 rotated ...
Leetcode: Reverse Words in a String II
›
Given an input string, reverse the string word by word. A word is defined as a sequence of non-space characters. The input string does no...
Leetcode: Largest Number
›
Given a list of non negative integers, arrange them such that they form the largest number. For example, given [3, 30, 34, 5, 9] , the l...
Leetcode: Factorial Trailing Zeroes
›
Given an integer n , return the number of trailing zeroes in n !. Note: Your solution should be in logarithmic time complexity. Cred...
Leetcode: Excel Sheet Column Number
›
Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its corresponding column number. ...
Leetcode: Excel Sheet Column Title
›
Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: 1 -> A 2 -> B ...
Leetcode: Two Sum II - Input array is sorted
›
Given an array of integers that is already sorted in ascending order , find two numbers such that they add up to a specific target number....
Leetcode: Maximum Gap
›
Given an unsorted array, find the maximum difference between the successive elements in its sorted form. Try to solve it in linear time/s...
1 comment:
Wednesday, August 26, 2015
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. You ma...
Leetcode: Read N Characters Given Read4 – Call multiple times
›
Question: Similar to Question [15. Read N Characters Given Read4], but the read function may be called multiple times. Solution: This mak...
2 comments:
Leetcode: Read N Characters Given Read4
›
The API: int read4(char *buf) reads 4 characters at a time from a file. The return value is the actual number of characters read. For e...
Leetcode: Compare Version Numbers
›
Compare two version numbers version1 and version2 . If version1 > version2 return 1, if version1 < version2 return -1, ot...
Leetcode: 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 following two linked list...
Leetcode: Group Shifted Strings
›
Given a string, we can "shift" each of its letter to its successive letter, for example: "abc" -> "bcd" ....
3 comments:
Tuesday, August 25, 2015
Leetcode: One Edit Distance
›
http://buttercola.blogspot.com/2014/11/facebook-one-edit-distance.html Given two strings S and T, determine if they are both one edit dist...
‹
›
Home
View web version