随笔分类 -  leetcode

摘要:219. 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 that 阅读全文
posted @ 2017-02-05 16:30 花椰菜菜菜菜 阅读(153) 评论(0) 推荐(0)
摘要:217. Contains Duplicate Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears a 阅读全文
posted @ 2016-12-18 20:50 花椰菜菜菜菜 阅读(212) 评论(0) 推荐(0)
摘要:206. Reverse Linked List Reverse a singly linked list. 翻转一个单链表。 代码如下: 阅读全文
posted @ 2016-11-14 16:02 花椰菜菜菜菜 阅读(176) 评论(0) 推荐(0)
摘要:205. Isomorphic Strings Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced 阅读全文
posted @ 2016-11-14 10:58 花椰菜菜菜菜 阅读(318) 评论(0) 推荐(0)
摘要:202. Happy Number 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 @ 2016-11-09 11:41 花椰菜菜菜菜 阅读(210) 评论(0) 推荐(0)
摘要:198. House Robber 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 @ 2016-11-09 11:05 花椰菜菜菜菜 阅读(277) 评论(0) 推荐(0)
摘要:191. 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). Fo 阅读全文
posted @ 2016-11-09 10:13 花椰菜菜菜菜 阅读(174) 评论(0) 推荐(0)
摘要:190. Reverse Bits Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 0000001010010100000111 阅读全文
posted @ 2016-11-09 10:05 花椰菜菜菜菜 阅读(110) 评论(0) 推荐(0)
摘要:189. 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 to [5 阅读全文
posted @ 2016-11-08 17:25 花椰菜菜菜菜 阅读(142) 评论(0) 推荐(0)
摘要:172. Factorial Trailing Zeroes Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time compl 阅读全文
posted @ 2016-11-08 16:36 花椰菜菜菜菜 阅读(245) 评论(0) 推荐(0)
摘要:171. Excel Sheet Column Number Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its corresponding 阅读全文
posted @ 2016-11-08 11:45 花椰菜菜菜菜 阅读(226) 评论(0) 推荐(0)
摘要:169. 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. Y 阅读全文
posted @ 2016-11-08 10:58 花椰菜菜菜菜 阅读(169) 评论(0) 推荐(0)
摘要:168. Excel Sheet Column Title Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: 阅读全文
posted @ 2016-10-11 22:29 花椰菜菜菜菜 阅读(119) 评论(0) 推荐(0)
摘要:165. Compare Version Numbers Compare two version numbers version1 and version2.If version1 > version2 return 1, if version1 < version2 return -1, othe 阅读全文
posted @ 2016-10-11 19:40 花椰菜菜菜菜 阅读(101) 评论(0) 推荐(0)
摘要:160. 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 f 阅读全文
posted @ 2016-10-11 10:33 花椰菜菜菜菜 阅读(146) 评论(0) 推荐(0)
摘要:155. Min Stack Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack. 阅读全文
posted @ 2016-10-11 09:54 花椰菜菜菜菜 阅读(96) 评论(0) 推荐(0)
摘要:141. Linked List Cycle Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using extra space? 判断一个单链表中是否存在环。不利用 阅读全文
posted @ 2016-10-10 21:22 花椰菜菜菜菜 阅读(106) 评论(0) 推荐(0)
摘要:137. Single Number II Given an array of integers, every element appears three times except for one. Find that single one. Note:Your algorithm should h 阅读全文
posted @ 2016-10-10 20:59 花椰菜菜菜菜 阅读(88) 评论(0) 推荐(0)
摘要:136. Single Number Given an array of integers, every element appears twice except for one. Find that single one. Note:Your algorithm should have a lin 阅读全文
posted @ 2016-10-05 17:27 花椰菜菜菜菜 阅读(111) 评论(0) 推荐(0)
摘要:125. Valid Palindrome Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example,"A man 阅读全文
posted @ 2016-10-01 16:49 花椰菜菜菜菜 阅读(250) 评论(0) 推荐(0)