自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

sadjuno的博客

一只埋头进步的小菜鸟

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

原创 10.15

入职也有快半年了,工作差不多都已经上手,是时候重新更新博客啦~

2017-10-15 20:12:52 165

原创 [394]Decode String

【题目描述】Given an encoded string, return it's decoded string.The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times. No

2016-09-16 17:46:54 837

原创 [396]Rotate Function

【题目描述】Given an array of integers A and let n to be its length.Assume Bk to be an array obtained by rotating the array A k positions clock-wise, we define a "rotation function" F on A as

2016-09-14 11:09:58 285

原创 [309] Best Time to Buy and Sell Stock with Cooldown

【题目描述】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 complete as many transactions as you like

2016-09-08 21:27:15 281

原创 [337]House Robber III

【题目描述】The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root." Besides the root, each house has one and only one parent house.

2016-09-07 21:53:38 213

原创 [377] Combination Sum IV

【题目描述】Given an integer array with all positive numbers and no duplicates, find the number of possible combinations that add up to a positive integer target.Example:nums = [1, 2, 3]target

2016-09-06 17:21:33 205

原创 [392]Is Subsequence

【题目描述】Given a string s and a string t, check if s is subsequence of t.You may assume that there is only lower case English letters in both s and t. t is potentially a very long (length ~= 50

2016-09-06 15:10:03 356

原创 [319]Bulb Switcher

【题目描述】There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle every third bulb (turning on if it's off or

2016-09-05 20:33:39 165

原创 [343]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, give

2016-09-05 15:49:45 232

原创 [357]Count Numbers with Unique Digits

【题目描述】Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x n.Example:Given n = 2, return 91. (The answer should be the total numbers in the range of 0 ≤ x [

2016-09-05 11:33:52 200

原创 [347] 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 ≤

2016-09-04 14:30:30 184

原创 [382]Linked List Random Node

【题目描述】Given a singly linked list, return a random node's value from the linked list. Each node must have the same probability of being chosen.Follow up:What if the linked list is extremely

2016-09-03 13:44:48 222

原创 [167]Two Sum II - Input array is sorted

【题目描述】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 th

2016-09-03 10:25:36 185

原创 [15]3Sum

【题目描述】Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note: The solution set must

2016-09-02 11:27:37 176

原创 [374]Guess Number Higher or Lower

【题目描述】We are playing the Guess Game. The game is as follows:I pick a number from 1 to n. You have to guess which number I picked.Every time you guess wrong, I'll tell you whether the

2016-09-01 11:44:33 170

原创 [389]Find the Difference

【题目描述】Given two strings s and t which consist of only lowercase letters.String t is generated by random shuffling string s and then add one more letter at a random position.Find the lett

2016-08-31 21:58:29 198

原创 [1] Two Sum

【题目描述】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 exactly one solution.Example:

2016-08-31 21:27:58 191

原创 [299] Bulls and Cows

[题目描述]You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. Each time your friend makes a guess, you prov

2016-08-31 15:01:36 218

原创 [345]Reverse Vowels of a String

【题目描述】Write a function that takes a string as input and reverse only the vowels of a string.Example 1:Given s = "hello", return "holle".Example 2:Given s = "leetcode", return "leotce

2016-08-31 11:01:18 208

原创 [342] Power of Four

【题目描述】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 false.Follow up: Could you solv

2016-08-27 21:22:27 344

原创 [387] First Unique Character in a String

【题目描述】Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1.Examples:s = "leetcode"return 0.s = "loveleetcode",return 2.

2016-08-27 21:13:47 305

原创 [326]Power of Three

【题目描述】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?【题目思路】如果是3的幂必然取以3为底的对数得到的是整数,而stl库里有log的函数,

2016-08-27 20:28:08 360

原创 [350]Intersection of Two Arrays II

【题目描述】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 element in the result should

2016-08-21 21:00:13 164

原创 [349]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].Note:Each element in the result must be un

2016-08-21 20:22:36 134

原创 [383]Ransom Note

【题目描述】
Given
 an 
arbitrary
 ransom
 note
 string 
and 
another 
string 
containing 
letters from
 all 
the 
magazines,
 write 
a 
function 
that 
will 
return 
true 
if 
the 
ransom 
 note 
can

2016-08-21 17:19:04 286

转载 线程安全和线程不安全理解

转载自:http://blog.csdn.net/ghevinn/article/details/37764791线程安全就是多线程访问时,采用了加锁机制,当一个线程访问该类的某个数据时,进行保护,其他线程不能进行访问直到该线程读取完,其他线程才可使用。不会出现数据不一致或者数据污染。 线程不安全就是不提供数据访问保护,有可能出现多个线程先后更改数据造成所得到的数据是脏数据

2016-08-21 15:32:11 339

原创 5.19

阿里面试总结:实习校招一面(已跪):本来应该是早上九点四十五面的,因为提前一个小时到的,所以先到就先面了。面我的面试官是一个花名叫醉易的面试官,全程不知道是为了装逼还是个人风格如此,我不会什么就问什么,明明我简历上写的是方向是图像处理,结果一直在问网络编程的问题,问语言的话也是一直在问c语言方面的,我之前准备的大一堆全都没用上,欲哭无泪。。。不过还是要做总结下。1.linux方面:

2016-05-19 19:35:13 275

原创 5.11

百度面试一面:问的问题基本都答上来了,面试官很满意,大概半小时就很顺利的通过了(据二面的面试官说一面和笔试分数都蛮高的)。有空把题目补充上来。二面总结:1、先是问了下项目,让介绍了一下项目是干什么以及自己负责的部分。2、问了算法,让讲下实现最长公共子串的算法思路(思路卡掉了,一开始没答上来,后来答了最简单的方法,然后问有什么可以优化的方法,一开始没想到,后来在提示下想到了用二分

2016-05-11 19:52:41 271

转载 HTTPS那些事 用java实现HTTPS工作原理

原文出处:http://kingj.iteye.com/blog/2103662,原文有实现代码。  今天被问到关于https原理的问题,结果由于知识掌握不牢靠,停留于表面,很多细节都无法回答清楚,于是决定把https的原理弄个明白,废话不多说,我们先看看https的定义 (由于很久未写博客,排版有些凌乱,请谅解)一:什么是https协议     在说HTTPS

2016-03-29 10:52:39 688

原创 2016.3.20

好久没更博了。最近一直在忙着找暑假实习,投了好几家,阿里已经过了三面,腾讯找人直接往部门投的简历,周五的时候去面了华泰证券,周六晚上做了大摩的笔试估计跪了,下礼拜二有网易的在线笔试。嗯,目前就是这样的情况吧。感觉开始找实习给我打开了一扇新的大门,一点一点发现以前的自己就像井底之蛙一样,明明什么都不会,还骄傲自满,以为自己拿了国奖就有多了不起。不管这次找实习的结果如何,离正式找工作还有小半年

2016-03-20 21:40:24 249

转载 数据库常见的面试题

http://blog.csdn.net/zhanghaotian2011/article/details/89043651.     三个范式即: 属性唯一,   记录唯一,   表唯一 第一范式(1NF):数据库表中的字段都是单一属性的,不可再分。这个单一属性由基本类型构成,包括整型、实数、字符型、逻辑型、日期型等。第二范式(2NF):数据库表中不存

2016-03-14 16:07:42 544

转载 判断一个单链表是否有环及环的链接点

给定一个单链表,只给出头指针h:1、如何判断是否存在环?2、如何知道环的长度?3、如何找出环的连接点在哪里?4、带环链表的长度是多少? 解法:1、对于问题1,使用追赶的方法,设定两个指针slow、fast,从头指针开始,每次分别前进1步、2步。如存在环,则两者相遇;如不存在环,fast遇到NULL退出。2、对于问题2,记录下问题1的碰

2016-03-09 10:26:29 291

原创 328. Odd Even Linked List

【题目】Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.You should try to do i

2016-03-06 16:38:02 225

原创 CCF201509-4 高速公路(有向图强连通分量)

【题目描述】问题描述  某国有n个城市,为了使得城市间的交通更便利,该国国王打算在城市之间修一些高速公路,由于经费限制,国王打算第一阶段先在部分城市之间修一些单向的高速公路。  现在,大臣们帮国王拟了一个修高速公路的计划。看了计划后,国王发现,有些城市之间可以通过高速公路直接(不经过其他城市)或间接(经过一个或多个其他城市)到达,而有的却不能。如果城市A可以通过高速公路

2015-12-21 11:08:14 1320 3

原创 [199]Binary Tree Right Side View

【题目描述】Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.For example:Given the following binary t

2015-12-09 11:01:53 203

原创 [129]Sum Root to Leaf Numbers

【题目描述】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 which represents the number 123.F

2015-12-08 21:54:45 246

原创 [303]Range Sum Query - Immutable

【题目描述】Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.Example:Given nums = [-2, 0, 3, -5, 2, -1]sumRange(0, 2) -> 1sumRange(2, 5)

2015-12-08 20:30:14 189

转载 最小生成树之prim算法

利用 普里姆算法 要解决如上问题,首先我们构造图的邻接矩阵。如下图所示:注意:实际中我们用65535来代表无穷大。关于普里姆算法以及讲解如下图:

2015-12-06 17:12:53 307 1

原创 CCF201412-4 最佳灌溉(最小代价生成树)

【题目描述】问题描述  雷雷承包了很多片麦田,为了灌溉这些麦田,雷雷在第一个麦田挖了一口很深的水井,所有的麦田都从这口井来引水灌溉。  为了灌溉,雷雷需要建立一些水渠,以连接水井和麦田,雷雷也可以利用部分麦田作为“中转站”,利用水渠连接不同的麦田,这样只要一片麦田能被灌溉,则与其连接的麦田也能被灌溉。  现在雷雷知道哪些麦田之间可以建设水渠和建设每个水渠所需要的费用(注

2015-12-06 17:00:20 318

转载 最小生成树之kruskal算法

克鲁斯卡尔算法是直接以边为目标去构建。因为权值是在边上,直接去找最小权值的边来构建生成树也是很自然的想法,只不过构建时要考虑是否会形成环路而已。此时我们用到了图的存储结构中的边集数组结构。以下是边集数组结构的定义代码:本算法所用同普里姆算法的实例,我们直接创建图的边集数组。并对边的权值从小到大排序后如下图:

2015-12-06 16:58:03 355

空空如也

空空如也

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

TA关注的人

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