自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(54)
  • 收藏
  • 关注

原创 447. Number of Boomerangs(飞去来器)

Given n points in the plane that are all pairwise distinct, a “boomerang” is a tuple of points (i, j, k) such that the distance between i and j equals the distance between i and k (the order of the tu...

2018-03-30 10:53:16 116

原创 443. String Compression

Given an array of characters, compress it in-place.The length after compression must always be smaller than or equal to the original array.Every element of the array should be a character (not int...

2018-03-30 09:49:51 105

原创 438. Find All Anagrams in a String

Given a string s and a non-empty string p, find all the start indices of p’s anagrams in s.Strings consists of lowercase English letters only and the length of both strings s and p will not be large...

2018-03-28 22:44:12 77

转载 ubuntu下anaconda解决python2与python3共存问题

转自https://blog.csdn.net/u010801439/article/details/79485914首先,大家需要了解的是,在原有的ubuntu系统下,是具备python环境的,但是,为了在不同的时期,会有不同的需要,有时候,需要的使用python2,但也有些情况时需要使用python3 ,那么,如何才能够,在ubuntu系统下随意切换,并且快速使用python2,pytho...

2018-03-28 15:49:26 1681

原创 ubuntu 无法解析主机的解决方法

修改ubuntu主机的名称后,在执行sudo命令时,会提示sudo: unable to resolve host ,亦即无法解析主机。 解决办法: sudo gedit /etc/hosts找到如下行: 127.0.1.1 XXX 将其修改为: 127.0.1.1 (你现在的主机名) 注:可以使用全部替换...

2018-03-27 10:05:40 1618

转载 L1正则化产生稀疏模型,L2正则防止过拟合

转自https://blog.csdn.net/jinping_shi/article/details/52433975L1正则产生稀疏模型的理解:J=J0+alpha∑w|w|(1)(1)J=J0+alpha∑w|w| J=J_0+alpha \sum_{w}|w|\tag{1} 其中J0J0J_0 是原始的损失函数,后半部分为L1L1L_1 正则化项,为绝对值之和,JJJ 带有绝...

2018-03-25 20:41:01 6546 3

原创 20180323TX面试记

关于项目: 1.出于什么考虑选择这个方案,有没有尝试别的方法 2.成果:以数字量化的指标如何 3.用过什么网络?(leNet-5)给出两个以上为宜 4.对于卷积层和全连接层的理解 卷积层、池化层和激活函数层等操作是将原始数据映射到隐层特征空间,全连接层起到将学到的特征表示映射到样本的标记空间的作用。 https://www.zhihu.com/question/41037974 ...

2018-03-24 15:51:54 98

原创 441. Arranging Coins

You have a total of n coins that you want to form in a staircase shape, where every k-th row must have exactly k coins.Given n, find the total number of full staircase rows that can be formed.n is...

2018-03-24 15:42:09 100

原创 113. Path Sum II

Given a binary tree and a sum, find all root-to-leaf paths where each path’s sum equals the given sum.For example: Given the below binary tree and sum = 22, 5 / \ ...

2018-03-21 11:40:51 79

原创 437. Path Sum III

You are given a binary tree in which each node contains an integer value.Find the number of paths that sum to a given value.The path does not need to start or end at the root or a leaf, but it mus...

2018-03-21 11:07:34 74

原创 434. Number of Segments in a String

Count the number of segments in a string, where a segment is defined to be a contiguous sequence of non-space characters.Please note that the string does not contain any non-printable characters.E...

2018-03-21 10:01:21 68

原创 415. Add Strings

Given two non-negative integers num1 and num2represented as string, return the sum of num1 and num2.Note:The length of both num1 and num2 is < 5100.Both num1 and num2 contains only digits 0-9...

2018-03-20 11:38:37 77

原创 414. Third Maximum Number

Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexity must be in O(n).Example 1: Input: [3, 2, ...

2018-03-20 10:30:01 80

原创 412. Fizz Buzz

Write a program that outputs the string representation of numbers from 1 to n.But for multiples of three it should output “Fizz” instead of the number and for the multiples of five output “Buzz”. Fo...

2018-03-19 10:35:12 83

原创 409. Longest Palindrome

Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters.This is case sensitive, for example "Aa" is not consi...

2018-03-19 09:58:11 86

原创 405. Convert a Number to Hexadecimal

Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method is used.Note:All letters in hexadecimal (a-f) must be in lowercase.The hexadecima...

2018-03-18 20:51:05 111

原创 404. Sum of Left Leaves

Find the sum of all left leaves in a given binary tree.Example: 3 / \ 9 20 / \ 15 7There are two left leaves in the binary tree, with values 9 and 15 respectively. Return 24...

2018-03-18 18:20:05 85

原创 401. Binary Watch

A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59).Each LED represents a zero or one, with the least significant bit on ...

2018-03-18 17:35:16 114

原创 400. Nth Digit

Find the Nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, …Note: n is positive and will fit within the range of a 32-bit signed integer (n < 2^31).Example 1: I...

2018-03-18 11:39:03 88

原创 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 letter that was adde...

2018-03-17 11:24:18 77

原创 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.Not...

2018-03-17 10:05:50 81

原创 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 be constructed from the magazines ; ot...

2018-03-16 10:44:24 147

原创 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 number is higher or...

2018-03-16 08:50:16 100

原创 位操作总结

WikiBit manipulation is the act of algorithmically manipulating bits or other pieces of data shorter than a word. Computer programming tasks that require bit manipulation include low-level device co...

2018-03-15 11:04:38 210

原创 371. Sum of Two Integers

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. 方法一:class Solution {public: int getSum(int a, int ...

2018-03-15 10:41:12 95

原创 367. Valid Perfect Square

Given a positive integer num, write a function which returns True if num is a perfect square else False.Note: Do not use any built-in library function such as sqrt. 不要使用任何内建函数sqrt Example 1: I...

2018-03-15 10:04:34 62

原创 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 appear as many times a...

2018-03-14 11:13:54 72

原创 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 unique. The result can ...

2018-03-14 09:37:56 173 1

原创 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) -> -1su...

2018-03-13 14:33:33 77

原创 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 “leotcede”.Note: The...

2018-03-13 10:23:53 93

原创 344. Reverse String

Write a function that takes a string as input and returns the string reversed. 方法一: Runtime Errorclass Solution {public: string reverseString(string s) { string t; for(i...

2018-03-13 09:44:16 75

原创 292. Nim Game

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 stones. The one who removes the last stone will be the...

2018-03-12 15:45:40 150

原创 290. Word Pattern

Given a pattern and a string str, find if str follows the same pattern.Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in str.Exampl...

2018-03-12 11:47:57 104

原创 283. 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 your fu...

2018-03-09 21:42:41 75

原创 278. First Bad Version

You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the...

2018-03-09 18:15:44 69

转载 异或的应用

转自https://www.lijinma.com/blog/2014/05/29/amazing-xor/MAY 29TH, 2014什么是异或?Wikipedia的解释:在逻辑学中,逻辑算符异或(exclusive or)是对两个运算元的一种逻辑析取类型,符号为 XOR 或 EOR 或 ⊕(编程语言中常用^)。但与一般的逻辑或不同,异或算符的值为真仅当两个运算元中恰有一个的值为真,而另外一个的...

2018-03-09 17:25:43 237

原创 268. Missing Number

Given an array containing n distinct numbers taken from 0, 1, 2, …, n, find the one that is missing from the array.Example 1 Input: [3,0,1] Output: 2Example 2 Input: [9,6,4,2,3,5,7,0,1...

2018-03-09 17:16:36 83

原创 263. Ugly Number

Write a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not ugly since it...

2018-03-08 20:27:58 129

原创 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 solve it without loop...

2018-03-08 17:11:20 78

原创 258. 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 only one dig...

2018-03-07 16:40:04 90

空空如也

空空如也

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

TA关注的人

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