08 2016 档案

摘要:You have two every large binary trees: T1, with millions of nodes, and T2, with hundreds of nodes. Create an algorithm to decide if T2 is a subtree of 阅读全文
posted @ 2016-08-29 22:35 YuriFLAG 阅读(152) 评论(0) 推荐(0)
摘要:Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the leng 阅读全文
posted @ 2016-08-22 21:58 YuriFLAG 阅读(177) 评论(0) 推荐(0)
摘要:You need to write a function, which will accept a String and return first non-repeated character, for example in the world "hello", except 'l' all are 阅读全文
posted @ 2016-08-22 17:03 YuriFLAG 阅读(211) 评论(0) 推荐(0)
摘要:Sort a linked list using insertion sort. 阅读全文
posted @ 2016-08-20 08:59 YuriFLAG 阅读(110) 评论(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. 阅读全文
posted @ 2016-08-19 16:12 YuriFLAG 阅读(117) 评论(0) 推荐(0)
摘要:A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep copy 阅读全文
posted @ 2016-08-17 09:51 YuriFLAG 阅读(103) 评论(0) 推荐(0)
摘要:Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 阅读全文
posted @ 2016-08-16 19:59 YuriFLAG 阅读(116) 评论(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 阅读全文
posted @ 2016-08-16 09:23 YuriFLAG 阅读(142) 评论(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, 阅读全文
posted @ 2016-08-16 09:16 YuriFLAG 阅读(111) 评论(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 @ 2016-08-16 09:09 YuriFLAG 阅读(112) 评论(0) 推荐(0)
摘要:Given a list, rotate the list to the right by k places, where k is non-negative. For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3- 阅读全文
posted @ 2016-08-15 22:54 YuriFLAG 阅读(103) 评论(0) 推荐(0)
摘要:Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of nodes is not a multiple of k then l 阅读全文
posted @ 2016-08-14 10:23 YuriFLAG 阅读(125) 评论(0) 推荐(0)
摘要:Given a linked list, swap every two adjacent nodes and return its head. For example,Given 1->2->3->4, you should return the list as 2->1->4->3. Your a 阅读全文
posted @ 2016-08-14 09:45 YuriFLAG 阅读(133) 评论(0) 推荐(0)
摘要:Given a singly linked list, determine if it is a palindrome. Follow up:Could you do it in O(n) time and O(1) space? 解题报告: 1. 找到LinkedList 的中点 2. 翻转链表( 阅读全文
posted @ 2016-08-13 10:17 YuriFLAG 阅读(123) 评论(0) 推荐(0)
摘要:Reverse a singly linked list. recursive version iterative version 阅读全文
posted @ 2016-08-13 09:23 YuriFLAG 阅读(90) 评论(0) 推荐(0)
摘要:Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements 阅读全文
posted @ 2016-08-07 15:39 YuriFLAG 阅读(117) 评论(0) 推荐(0)
摘要:Given an array of integers, every element appears twice except for one. Find that single one. Note:Your algorithm should have a linear runtime complex 阅读全文
posted @ 2016-08-07 15:23 YuriFLAG 阅读(119) 评论(0) 推荐(0)
摘要:Given an array of integers, every element appears three times except for one. Find that single one. Note:Your algorithm should have a linear runtime c 阅读全文
posted @ 2016-08-07 15:19 YuriFLAG 阅读(102) 评论(0) 推荐(0)
摘要:There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle every 阅读全文
posted @ 2016-08-06 21:59 YuriFLAG 阅读(201) 评论(0) 推荐(0)
摘要:We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to guess which number I picked. Every time you guess wron 阅读全文
posted @ 2016-08-05 22:31 YuriFLAG 阅读(151) 评论(0) 推荐(0)