随笔分类 -  LeetCode_OJ

摘要:Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.题目:给一组字符串,返回所有满足Anagrams(回文构词法)的字符串;A... 阅读全文
posted @ 2015-08-01 11:11 AndyJee 阅读(483) 评论(0) 推荐(0) 编辑
摘要:Given two wordsword1andword2, find the minimum number of steps required to convertword1toword2. (each operation is counted as 1 step.)You have the fol... 阅读全文
posted @ 2015-06-26 17:22 AndyJee 阅读(804) 评论(0) 推荐(0) 编辑
摘要:Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[−2,1,−3,4,−1,2,1,... 阅读全文
posted @ 2015-06-26 14:51 AndyJee 阅读(435) 评论(0) 推荐(0) 编辑
摘要:Given amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along its path.Note:Yo... 阅读全文
posted @ 2015-06-26 09:48 AndyJee 阅读(512) 评论(0) 推荐(0) 编辑
摘要:Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted fr... 阅读全文
posted @ 2015-05-07 21:56 AndyJee 阅读(1054) 评论(0) 推荐(0) 编辑
摘要:There are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following req... 阅读全文
posted @ 2015-05-06 20:17 AndyJee 阅读(1556) 评论(0) 推荐(0) 编辑
摘要:Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the ... 阅读全文
posted @ 2015-05-03 11:40 AndyJee 阅读(301) 评论(0) 推荐(0) 编辑
摘要:Given an unsorted integer array, find the first missing positive integer.For example,Given [1,2,0] return 3,and [3,4,-1,1] return 2.Your algorithm sho... 阅读全文
posted @ 2015-05-02 16:03 AndyJee 阅读(395) 评论(0) 推荐(0) 编辑
摘要:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum element.Yo... 阅读全文
posted @ 2015-05-02 11:46 AndyJee 阅读(814) 评论(0) 推荐(0) 编辑
摘要: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,6,7,1,2,3,4].题目:给一... 阅读全文
posted @ 2015-05-01 15:37 AndyJee 阅读(187) 评论(0) 推荐(0) 编辑
摘要:Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.For example,Given 1->2-... 阅读全文
posted @ 2015-04-29 21:01 AndyJee 阅读(1787) 评论(0) 推荐(0) 编辑
摘要:Given a sorted linked list, delete all duplicates such that each element appear only once. For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3. 题目要求: 给一有序链表,删除重复的结点,使得每个元素只出现一... 阅读全文
posted @ 2015-04-28 22:25 AndyJee 阅读(259) 评论(0) 推荐(0) 编辑
摘要:Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the original relative order of the nodes in each of th... 阅读全文
posted @ 2015-04-28 21:46 AndyJee 阅读(893) 评论(1) 推荐(0) 编辑
摘要:Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a... 阅读全文
posted @ 2015-04-28 21:10 AndyJee 阅读(201) 评论(0) 推荐(0) 编辑
摘要:1、Given a linked list, determine if it has a cycle in it.2、Given a linked list, return the node where the cycle begins. If there is no cycle, return n... 阅读全文
posted @ 2015-04-28 20:45 AndyJee 阅读(812) 评论(0) 推荐(1) 编辑
摘要:Remove all elements from a linked list of integers that have value val. ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 --> 3 --> 4 –> 5 题目要求: 删除链表中包含val的元素结点 解题思路: 重点在于找到... 阅读全文
posted @ 2015-04-28 00:13 AndyJee 阅读(436) 评论(0) 推荐(0) 编辑
摘要:Reverse a linked list from position m to n. Do it in-place and in one-pass. For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4, return 1->4->3->2->5->NULL. Note:Given m, n satisfy the following co... 阅读全文
posted @ 2015-04-27 22:47 AndyJee 阅读(174) 评论(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 @ 2015-04-27 21:16 AndyJee 阅读(230) 评论(0) 推荐(0) 编辑
摘要:Given a set of distinct integers, S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not c... 阅读全文
posted @ 2015-04-25 21:12 AndyJee 阅读(421) 评论(0) 推荐(0) 编辑

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