摘要: Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: 1 / \ 2 3 \ 5 All root-to-leaf paths are: ["1->2->5" 阅读全文
posted @ 2017-05-11 12:44 anghostcici 阅读(92) 评论(0) 推荐(0) 编辑
摘要: Given a positive integer num, write a function which returns True if num is a perfect square else False. Note: Do not use any built-in library functio 阅读全文
posted @ 2017-05-07 16:43 anghostcici 阅读(82) 评论(0) 推荐(0) 编辑
摘要: Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may comple 阅读全文
posted @ 2017-05-07 09:54 anghostcici 阅读(100) 评论(0) 推荐(0) 编辑
摘要: Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction 阅读全文
posted @ 2017-05-05 15:45 anghostcici 阅读(124) 评论(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 @ 2017-05-05 00:13 anghostcici 阅读(91) 评论(0) 推荐(0) 编辑
摘要: Given a List of words, return the words that can be typed using letters of alphabet on only one row's of American keyboard like the image below. Examp 阅读全文
posted @ 2017-05-04 02:33 anghostcici 阅读(107) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2017-04-26 15:58 anghostcici 阅读(8) 评论(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? idea: Firstly find the middle node 阅读全文
posted @ 2017-04-18 13:49 anghostcici 阅读(67) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2017-04-16 16:24 anghostcici 阅读(4) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j]and the a 阅读全文
posted @ 2017-04-06 15:57 anghostcici 阅读(98) 评论(0) 推荐(0) 编辑