自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

沉淀。

小本一枚

  • 博客(18)
  • 收藏
  • 关注

原创 vbox 命令行操作

老大让搭个服务器,做IoT端的接受服务器。我选了KAA,官网提供vbox的沙盒镜像,直接装即可。服务器上装的是centos,我就想直接在centos上装virtuanl box ,然后导入沙盒。奈何服务器是个workstation,木有图形界面,一下懵逼了。镇定之下,想起可以命令行导入虚拟机。1.导入虚拟机 VBoxManage  import kaa-sandbox-0.9.0.

2016-08-18 16:59:11 3679

原创 leetcode Majority Element

Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element

2016-08-04 16:35:15 274

原创 leetcode Integer Break

Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum product you can get.For example, given n = 2, ret

2016-08-04 16:28:05 247

原创 leetcode Valid Anagram

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 = "car", return false.用一个26位长度的桶

2016-08-04 16:18:40 249

原创 leetcode Excel Sheet Column Number

Given a column title as appear in an Excel sheet, return its corresponding column number.For example: A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 28 思路,就是26进

2016-08-04 16:15:45 237

原创 leetcode Top K Frequent Elements

Given a non-empty array of integers, return the k most frequent elements.For example,Given [1,1,1,2,2,3] and k = 2, return [1,2].Note: You may assume k is always valid, 1 ≤ k ≤ number

2016-08-03 17:50:09 244

原创 leetcode Same Tree

Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value.思路:这

2016-08-03 17:37:06 195

原创 Intersection of Two Arrays

Given two arrays, write a function to compute their intersection.Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2].思路,求两个数组的交集。很明显要用hashmap或者集合,字典的数据结构,因为他们的key都是唯

2016-08-03 17:24:47 224

原创 leetcode Product of Array Except Self

Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements ofnums except nums[i].Solve it without division and in O(

2016-08-03 17:20:28 463

原创 leetcode Move Zeroes

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, given nums = [0, 1, 0, 3, 12], after calling you

2016-08-03 17:11:20 218

原创 leetcode Revert Binary Tree

homebrew的作者面试google,面试官要求他手写一个反转一个二叉树的功能。最后却没写出来,于是有了下面的新闻:Google: 90% of our engineers use the software you wrote (Homebrew), but you can’t invert a binary tree on a whiteboard so fuck off.

2016-08-02 17:38:57 288

原创 leetcode Maximum Depth of Binary Tree

Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.统计二叉树的最大深度,分为BFS,和DFS

2016-08-02 17:27:22 236

原创 leetcode Add digits

Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has on

2016-08-02 17:11:20 225

原创 leetcode single Number

Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using ext

2016-08-02 17:04:37 274

原创 Leetcode Sum of Two Intergers

Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -.Example:Given a = 1 and b = 2, return 3.思路:1.两数相与,得到进位情况.2.两数异或,得到和。(without carray)利用这两条

2016-08-02 16:52:13 359

原创 leetcode Nim Game

292.Nim GameYou 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 stones. The one who removes the last

2016-08-01 17:05:10 262

原创 leetcode Counting Bits

Counting BitsGiven 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.Ex

2016-08-01 16:40:38 249

原创 Leetcode Reverse String

LeetCode 344Write a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh".思路:两根指针,分别指向字符串首尾。互相交换所指向的数值。当两根指针相遇时,即可遍历完毕。time

2016-08-01 16:06:05 236

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除