摘要:
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 @ 2016-05-30 14:40
lilixu
阅读(134)
评论(0)
推荐(0)
摘要:
Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example:Given num = 16, return true. Given num = 5, return fa 阅读全文
posted @ 2016-05-19 17:13
lilixu
阅读(120)
评论(0)
推荐(0)
摘要:
Given an integer, write a function to determine if it is a power of three. Follow up:Could you do it without using any loop / recursion? 1162261467 = 阅读全文
posted @ 2016-05-19 16:28
lilixu
阅读(126)
评论(0)
推荐(0)
摘要:
Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2]. Note: Each element i 阅读全文
posted @ 2016-05-19 15:06
lilixu
阅读(262)
评论(0)
推荐(0)
摘要:
You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 ston 阅读全文
posted @ 2016-05-17 16:54
lilixu
阅读(115)
评论(0)
推荐(0)
摘要:
Given two strings s and t, write a function to determine if t is an anagram of s. For example,s = "anagram", t = "nagaram", return true.s = "rat", t = 阅读全文
posted @ 2016-05-17 16:12
lilixu
阅读(115)
评论(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-05-17 15:10
lilixu
阅读(111)
评论(0)
推荐(0)
摘要:
Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. For example, giv 阅读全文
posted @ 2016-05-17 14:23
lilixu
阅读(111)
评论(0)
推荐(0)
摘要:
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1->2->3 whic 阅读全文
posted @ 2016-05-17 10:12
lilixu
阅读(121)
评论(0)
推荐(0)
摘要:
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric: But the fol 阅读全文
posted @ 2016-05-16 14:58
lilixu
阅读(104)
评论(0)
推荐(0)
浙公网安备 33010602011771号