摘要: Description Description Given a linked list, determine if it has a cycle in it. To represent a cycle in the given linked list, we use an integer pos w 阅读全文
posted @ 2019-01-23 10:51 jjlovezz 阅读(163) 评论(0) 推荐(0) 编辑
摘要: Description Description Given a 32-bit signed integer, reverse digits of an integer. Example Example 1: Input: 123 Output: 321 Example 2: Input: -123 阅读全文
posted @ 2019-01-22 14:23 jjlovezz 阅读(113) 评论(0) 推荐(0) 编辑
摘要: Description 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 w 阅读全文
posted @ 2019-01-17 10:07 jjlovezz 阅读(187) 评论(0) 推荐(0) 编辑
摘要: Description Description Given a string and an offset, rotate string by offset. (rotate from left to right) Example Given "abcdefg". offset=0 => "abcde 阅读全文
posted @ 2018-12-07 17:08 jjlovezz 阅读(217) 评论(0) 推荐(0) 编辑
摘要: Description Description Design an algorithm and write code to serialize and deserialize a binary tree. Writing the tree to a file is called 'serializa 阅读全文
posted @ 2018-11-23 17:55 jjlovezz 阅读(229) 评论(0) 推荐(0) 编辑
摘要: Description Description Merge two given sorted integer array A and B into a new sorted integer array. Example A=[1,2,3,4] B=[2,4,5,6] return [1,2,2,3, 阅读全文
posted @ 2018-11-16 17:51 jjlovezz 阅读(131) 评论(0) 推荐(0) 编辑
摘要: Description Description Find K-th largest element in an array. Example In array [9,3,2,4,8], the 3rd largest element is 4. In array [1,2,3,4,5], the 1 阅读全文
posted @ 2018-11-13 12:17 jjlovezz 阅读(428) 评论(0) 推荐(0) 编辑
摘要: Description Description Ugly number is a number that only havefactors 2, 3 and 5. Design an algorithm to find the nth ugly number. The first 10 ugly n 阅读全文
posted @ 2018-11-08 15:52 jjlovezz 阅读(151) 评论(0) 推荐(0) 编辑
摘要: Description Description Count the number of k's between 0 and n. k can be 0 - 9. Example if n = 12, k = 1 in [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 阅读全文
posted @ 2018-11-06 15:56 jjlovezz 阅读(174) 评论(0) 推荐(0) 编辑
摘要: Description Description Write an algorithm which computes the number of trailing zeros in n factorial. Example 11! = 39916800, so the out should be 2 阅读全文
posted @ 2018-11-05 12:06 jjlovezz 阅读(557) 评论(0) 推荐(0) 编辑