随笔分类 -  LeetCode

Keep learning everyday !
摘要:题目: The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, ca 阅读全文
posted @ 2016-12-23 18:57 PolarBearInterest 阅读(693) 评论(0) 推荐(0) 编辑
摘要:题目: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a sin 阅读全文
posted @ 2016-12-06 11:07 PolarBearInterest 阅读(538) 评论(0) 推荐(0) 编辑
摘要:题目: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. 没事来做 阅读全文
posted @ 2016-12-02 00:19 PolarBearInterest 阅读(2072) 评论(0) 推荐(0) 编辑
摘要:1.题目: Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close i 阅读全文
posted @ 2016-11-24 16:09 PolarBearInterest 阅读(157) 评论(0) 推荐(0) 编辑
摘要:题目: Given a linked list, remove the nth node from the end of list and return its head. For example, Note: Given n will always be valid. Try to do this 阅读全文
posted @ 2016-11-16 23:47 PolarBearInterest 阅读(128) 评论(0) 推荐(0) 编辑
摘要:题目: Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the tel 阅读全文
posted @ 2016-11-14 18:10 PolarBearInterest 阅读(235) 评论(0) 推荐(0) 编辑
摘要:题目: Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integ 阅读全文
posted @ 2016-11-09 18:41 PolarBearInterest 阅读(123) 评论(0) 推荐(0) 编辑
摘要:题目: Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum 阅读全文
posted @ 2016-11-05 13:46 PolarBearInterest 阅读(261) 评论(0) 推荐(0) 编辑
摘要:题目: Given a string, sort it in decreasing order based on the frequency of characters. Example 1: Example 2: Example 3: 这个函数在collection模块的Counter类中: 于是 阅读全文
posted @ 2016-11-03 10:36 PolarBearInterest 阅读(180) 评论(0) 推荐(0) 编辑
摘要:题目: Write a function to find the longest common prefix string amongst an array of strings. Subscribe to see which companies asked this question Subscr 阅读全文
posted @ 2016-11-02 17:56 PolarBearInterest 阅读(101) 评论(0) 推荐(0) 编辑
摘要:题目: The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, return 阅读全文
posted @ 2016-10-18 14:44 PolarBearInterest 阅读(200) 评论(0) 推荐(0) 编辑
摘要:题目: The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed f 阅读全文
posted @ 2016-10-12 13:54 PolarBearInterest 阅读(149) 评论(0) 推荐(0) 编辑
摘要:题目: Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in 阅读全文
posted @ 2016-10-09 18:09 PolarBearInterest 阅读(1182) 评论(0) 推荐(0) 编辑
摘要:题目: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would hav 阅读全文
posted @ 2016-10-08 16:17 PolarBearInterest 阅读(168) 评论(0) 推荐(0) 编辑
摘要:题目: Given an array of integers, every element appears three times except for one. Find that single one. Your algorithm should have a linear runtime co 阅读全文
posted @ 2016-09-20 10:46 PolarBearInterest 阅读(148) 评论(0) 推荐(0) 编辑
摘要:题目: Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 题目只有一句话:把一个按升序排列的数组,装换成一个平衡二叉树。 代码: 很久没研究数据结构了,先 阅读全文
posted @ 2016-09-16 12:47 PolarBearInterest 阅读(945) 评论(0) 推荐(0) 编辑
摘要:题目: The set [1,2,3,…,n] contains a total of n! unique permutations. By listing and labeling all of the permutations in order, We get the following seq 阅读全文
posted @ 2016-09-13 15:09 PolarBearInterest 阅读(177) 评论(0) 推荐(0) 编辑
摘要:题目: Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Note: Do not modify the linked list. Follow up: Ca 阅读全文
posted @ 2016-09-12 19:56 PolarBearInterest 阅读(148) 评论(0) 推荐(0) 编辑
摘要:题目: Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1->2->3 阅读全文
posted @ 2016-09-09 15:59 PolarBearInterest 阅读(142) 评论(0) 推荐(0) 编辑
摘要:题目: Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5, Return 代码: 仔细一看,规律就是本层第一个和最后一个的元素都是1,其他的元素分别等于上一层同 阅读全文
posted @ 2016-09-08 14:38 PolarBearInterest 阅读(177) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示