上一页 1 ··· 27 28 29 30 31 32 33 34 35 ··· 37 下一页
摘要: 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-07-19 18:34 immjc 阅读(120) 评论(0) 推荐(0) 编辑
摘要: Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method is used. Note: All letters in hexadec 阅读全文
posted @ 2017-07-19 18:18 immjc 阅读(142) 评论(0) 推荐(0) 编辑
摘要: Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2. Note: 给定两个只含有数字字符串,将字符串中的数字和返回一个字符串。并且要求不能使用整数类库 阅读全文
posted @ 2017-07-19 17:06 immjc 阅读(109) 评论(0) 推荐(0) 编辑
摘要: Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 将一个有序的数组转换为一棵高度平衡的二叉树。这道题像中序遍历的逆过程。所以先找到数组中中间位置的值作为树 阅读全文
posted @ 2017-07-19 16:34 immjc 阅读(107) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longestpath betwee 阅读全文
posted @ 2017-07-19 16:13 immjc 阅读(131) 评论(0) 推荐(0) 编辑
摘要: You are given a string representing an attendance record for a student. The record only contains the following three characters: 'A' : Absent. 'L' : L 阅读全文
posted @ 2017-07-18 22:11 immjc 阅读(124) 评论(0) 推荐(0) 编辑
摘要: Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from the start of the string. If there ar 阅读全文
posted @ 2017-07-18 21:40 immjc 阅读(121) 评论(0) 推荐(0) 编辑
摘要: Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example,Given nums = [0, 1, 阅读全文
posted @ 2017-07-18 15:25 immjc 阅读(131) 评论(0) 推荐(0) 编辑
摘要: Given two arrays, write a function to compute their intersection. Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2]. Note: Each eleme 阅读全文
posted @ 2017-07-18 15:03 immjc 阅读(138) 评论(0) 推荐(0) 编辑
摘要: Given an integer, return its base 7 string representation. Example 1: Input: 100 Output: "202" Example 2: Input: -7 Output: "-10" Note: The input will 阅读全文
posted @ 2017-07-18 14:46 immjc 阅读(162) 评论(0) 推荐(0) 编辑
上一页 1 ··· 27 28 29 30 31 32 33 34 35 ··· 37 下一页