随笔分类 -  LeetCode

摘要:Problem Definition:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example,"A man, a... 阅读全文
posted @ 2015-07-21 11:33 曾可爱 阅读(105) 评论(0) 推荐(0)
摘要:Problem Definition: Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto s... 阅读全文
posted @ 2015-07-20 20:46 曾可爱 阅读(159) 评论(0) 推荐(0)
摘要:Problem Definition:Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked ... 阅读全文
posted @ 2015-07-20 16:03 曾可爱 阅读(187) 评论(0) 推荐(0)
摘要:Problem Definition: Compare two version numbers version1 and version2. If version1 > version2 return 1, if version1 f2 else (-1 if f1b a=[1] b=[0,2... 阅读全文
posted @ 2015-07-20 14:49 曾可爱 阅读(131) 评论(0) 推荐(0)
摘要:Problem Definition: Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. Y... 阅读全文
posted @ 2015-07-19 22:21 曾可爱 阅读(157) 评论(0) 推荐(0)
摘要:Problem Definition: Given a column title as appear in an Excel sheet, return its corresponding column number. For example: A -> 1 B -> 2 C ->... 阅读全文
posted @ 2015-07-19 19:56 曾可爱 阅读(114) 评论(0) 推荐(0)
摘要:Problem Definition: Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time complexity.Sol... 阅读全文
posted @ 2015-07-19 16:41 曾可爱 阅读(90) 评论(0) 推荐(0)
摘要:Problem Definition: 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 t... 阅读全文
posted @ 2015-07-19 15:57 曾可爱 阅读(115) 评论(0) 推荐(0)
摘要:Problem Definition:Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 0000001010010100000111... 阅读全文
posted @ 2015-07-18 14:58 曾可爱 阅读(127) 评论(0) 推荐(0)
摘要:Problem Definition:Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).For ex... 阅读全文
posted @ 2015-07-18 14:13 曾可爱 阅读(151) 评论(0) 推荐(0)
摘要:Problem Definition:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed,the only cons... 阅读全文
posted @ 2015-07-18 12:01 曾可爱 阅读(157) 评论(0) 推荐(0)
摘要:Problem Definition:Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with a... 阅读全文
posted @ 2015-07-17 15:56 曾可爱 阅读(124) 评论(0) 推荐(0)
摘要:Problem Definition:Remove all elements from a linked list of integers that have value val. ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val =... 阅读全文
posted @ 2015-07-17 15:04 曾可爱 阅读(110) 评论(0) 推荐(0)
摘要:Problem Definition: Count the number of prime numbers less than a non-negative number, n.Hint: Let's start with a isPrime function. To determine if ... 阅读全文
posted @ 2015-07-17 13:39 曾可爱 阅读(218) 评论(0) 推荐(0)
摘要:Problem Definition:Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to ge... 阅读全文
posted @ 2015-07-17 13:35 曾可爱 阅读(147) 评论(0) 推荐(0)
摘要:Problem Definition: Reverse a singly linked list.Hint:A linked list can be reversed either iteratively or recursively. Could you implement both?Solut... 阅读全文
posted @ 2015-07-17 09:32 曾可爱 阅读(133) 评论(0) 推荐(0)
摘要:Problem Definition: Given an array of integers and an integer k, find out whether there there are two distinct indices i and j in the array such tha... 阅读全文
posted @ 2015-07-16 20:32 曾可爱 阅读(142) 评论(0) 推荐(0)
摘要:Problem Definition: Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at ... 阅读全文
posted @ 2015-07-16 17:14 曾可爱 阅读(82) 评论(0) 推荐(0)
摘要:Problem Definition:Find the total area covered by two rectilinear rectangles in a 2D plane.Each rectangle is defined by its bottom left corner and top... 阅读全文
posted @ 2015-07-16 16:55 曾可爱 阅读(177) 评论(0) 推荐(0)
摘要:Problem Definition: Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9 to 4 / \ 7 2 / \ / \9 6 3 1Trivia:This pr... 阅读全文
posted @ 2015-07-16 12:20 曾可爱 阅读(94) 评论(0) 推荐(0)