- 博客(8)
- 收藏
- 关注
原创 496. Next Greater Element I(C++)
题目 You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1’s elements in the corresponding places of nums
2017-02-28 12:12:57 447
原创 167. Two Sum II - Input array is sorted (C++)
题目 Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two nu
2017-02-28 00:19:42 397
原创 LeetCode:338. Counting Bits(C++)
题目 Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1’s in their binary representation and return them as an array.Example: For num = 5
2017-02-27 20:55:57 293
原创 500. Keyboard Row
题目 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.American keyboard Example 1: Input: [“Hello”,
2017-02-25 19:34:01 294
原创 求最大公约数
目前有三种常用的求两个数的最大公约数的方法: 1. 欧几里得算法 2. 连续整数检测算法 3. 分解质因数算法1.1 更相减损法 可半者半之,不可半者,副置分母、子之数,以少减多,更相减损,求其等也。以等数约之 判断是否存在偶数,如果有,则先除以二,然后大数减小数,差和小的那个数比较,仍然是较大的减较小的,(中间如果遇到偶数要除以二),求到最后会留下两数相等,这个数乘上以前消掉的几个
2017-02-24 21:34:13 670
原创 419. Battleships in a Board
题目 Given an 2D board, count how many battleships are in it. The battleships are represented with ‘X’s, empty slots are represented with ‘.’s. You may assume the following rules: You receive a val
2017-02-23 23:43:21 356
原创 476. Number Complement (C++)
题目 Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note: The given integer is guaranteed to fit within the rang
2017-02-23 00:46:56 395
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人