随笔分类 -  leetcode

摘要:Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321 阅读全文
posted @ 2016-10-26 22:21 冰凌花花~ 阅读(136) 评论(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 single 阅读全文
posted @ 2016-10-26 20:15 冰凌花花~ 阅读(121) 评论(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 have ex 阅读全文
posted @ 2016-10-26 18:34 冰凌花花~ 阅读(193) 评论(0) 推荐(0)
摘要:Write a method anagram(s,t) to decide if two strings are anagrams or not. 判断两个字符串里的字符是否相同,也就是是否能够通过改变字母顺序而变成相同的字符串。 如果是返回true,如果不是返回false。 Clarificati 阅读全文
posted @ 2016-09-09 18:05 冰凌花花~ 阅读(175) 评论(0) 推荐(0)
摘要:Merge k sorted linked lists 阅读全文
posted @ 2016-09-08 14:36 冰凌花花~ 阅读(166) 评论(0) 推荐(0)
摘要:Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. 给出一个所有元素以升序排序的单链表,将它转换成一棵高度平衡的二分查找树 阅读全文
posted @ 2016-08-29 11:58 冰凌花花~ 阅读(115) 评论(0) 推荐(0)
摘要:Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example,Given:s1 = "aabcc",s2 = "dbbca", When s3 = "aadbbcbcac", ret 阅读全文
posted @ 2016-08-24 14:53 冰凌花花~ 阅读(159) 评论(0) 推荐(0)
摘要:Given two strings, find the longest common substring. Return the length of it. Example Given A = "ABCD", B = "CBCE", return 2. Given A = "ABCD", B = " 阅读全文
posted @ 2016-08-24 11:13 冰凌花花~ 阅读(152) 评论(0) 推荐(0)
摘要:Given a string S and a string T, count the number of distinct subsequences of T in S. A subsequence of a string is a new string which is formed from t 阅读全文
posted @ 2016-08-23 15:54 冰凌花花~ 阅读(202) 评论(0) 推荐(0)
摘要:Given two strings, find the longest common subsequence (LCS). Your code should return the length of LCS. Clarification What's the definition of Longes 阅读全文
posted @ 2016-08-23 14:07 冰凌花花~ 阅读(168) 评论(0) 推荐(0)
摘要:Given a string s, partition s such that every substring of the partition is a palindrome. Return the minimum cuts needed for a palindrome partitioning 阅读全文
posted @ 2016-08-23 11:33 冰凌花花~ 阅读(138) 评论(0) 推荐(0)
摘要:Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words. For 阅读全文
posted @ 2016-08-22 16:19 冰凌花花~ 阅读(151) 评论(0) 推荐(0)
摘要:Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.) You have 阅读全文
posted @ 2016-08-21 17:29 冰凌花花~ 阅读(152) 评论(0) 推荐(0)
摘要:Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maxim 阅读全文
posted @ 2016-08-20 15:39 冰凌花花~ 阅读(261) 评论(0) 推荐(0)
摘要:Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the fo 阅读全文
posted @ 2016-08-18 20:01 冰凌花花~ 阅读(124) 评论(0) 推荐(0)
摘要:Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. 阅读全文
posted @ 2016-08-18 16:47 冰凌花花~ 阅读(141) 评论(0) 推荐(0)
摘要:Follow up for "Unique Paths": Now consider if some obstacles are added to the grids. How many unique paths would there be? An obstacle and empty space 阅读全文
posted @ 2016-08-18 16:19 冰凌花花~ 阅读(154) 评论(0) 推荐(0)
摘要:Given a binary tree, flatten it to a linked list in-place. For example,Given The flattened tree should look like: click to show hints. Hints: If you n 阅读全文
posted @ 2016-08-18 15:11 冰凌花花~ 阅读(184) 评论(0) 推荐(0)
摘要:Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical a 阅读全文
posted @ 2016-08-18 13:13 冰凌花花~ 阅读(162) 评论(0) 推荐(0)
摘要:Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST. Calling next() will return the n 阅读全文
posted @ 2016-08-17 23:07 冰凌花花~ 阅读(245) 评论(0) 推荐(0)