自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(28)
  • 资源 (2)
  • 收藏
  • 关注

原创 CentOS上安装 gcc-7

使用工具包devtoolset-7下载工具包devtoolset-7yum install devtoolset-7yum install devtoolset-7-gcc-c++yum install devtoolset-7-binutils将gcc-7等工具链加入环境变量scl enable devtoolset-7 bash...

2019-04-16 15:54:03 578

原创 解决MacOS升级后出现xcrun: error: invalid active developer path, missing xcrun的问题

今天升级macos mojave后,终端使用gcc时,弹出一行莫名其妙的错误解决方法,重装xcode command line:xcode-select --install如果没有解决,执行以下命令:sudo xcode-select -switch /...

2019-04-16 12:28:44 255

原创 LeetCode 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

2017-06-01 09:50:08 280

原创 LeetCode 599. Minimum Index Sum of Two Lists(map,unordered_map)

Suppose Andy and Doris want to choose a restaurant for dinner, and they both have a list of favorite restaurants represented by strings.You need to help them find out their common interest with th

2017-05-31 19:53:03 597

原创 LeetCode 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

2017-05-31 15:47:20 254

原创 LeetCode 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 res

2017-05-29 18:07:30 188

原创 LeetCode 455. Assign Cookies(数组,排序)

Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor gi, which is the minimum size of a c

2017-05-29 17:34:10 227

原创 LeetCode 100. 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.思路:如果两个节点中有一

2017-05-29 11:02:42 337

原创 LeetCode 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. Retur

2017-05-29 10:23:15 193

原创 LeetCode 167. Two Sum II - Input array is sorted(有序数组夹逼法)

Total Accepted: 74198Total Submissions: 157252Difficulty: EasyContributor: LeetCodeGiven an array of integers that is already sorted in ascending order, find two numbers such that they add up

2017-05-29 09:46:42 287

原创 LeetCode 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 you

2017-05-28 22:31:47 181

原创 LeetCode 258. Add Digits(1+(n-1)%9)

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

2017-05-28 22:06:51 214

原创 LeetCode 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.思路:使用位运算,a^b得到本位和,a&b得到进位,然后将“进位”左移与“和”相异或;循环上述操作。C

2017-05-28 21:09:54 218

原创 子数组和问题,和被某个数整除

1. 子数组和问题,和被元素个数整除    和被某个元素整除2. 子数组和问题,和被10整除    和被10整除

2017-05-28 20:12:57 1434

原创 越狱(快速幂取模)

问题描述:监狱有连续编号为1...N的N个房间,每个房间关押一个犯人,有M种宗教,每个犯人可能信仰其中一种。如果相邻房间的犯人的宗教相同,就可能发生越狱,求有多少种状态可能发生越狱。输入:输入两个整数M,N.1输出:可能越狱的状态数,模100003取余例子输入:2 3例子输出:66种状态为(000)(001)(011)(100)(110)(111)

2017-05-28 18:56:44 902

原创 LeetCode 171. Excel Sheet Column Number(进制转换)

Related to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example: A -> 1 B -> 2 C -> 3 ...

2017-05-27 20:42:05 225

原创 LeetCode 387. First Unique Character in a String(unordered_map元素顺序杂乱性)

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.Note: You m

2017-05-27 20:09:07 295

原创 LeetCode 169. 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

2017-05-27 12:33:35 169

原创 LeetCode 242. Valid Anagram(字谜)

Total Accepted: 153072Total Submissions: 333862Difficulty: EasyContributor: LeetCodeGiven two strings s and t, write a function to determine if t is an anagram of s.For example,s = "anagram"

2017-05-26 21:58:04 340

原创 LeetCode 448. Find All Numbers Disappeared in an Array(查找数组中没有出现的数字)

Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements of [1, n] inclusive that do not appear in this array.

2017-05-26 21:06:27 249

原创 LeetCode 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 con

2017-05-26 20:49:34 435 1

原创 LeetCode 520:Detect Capital

Given a word, you need to judge whether the usage of capitals in it is right or not.We define the usage of capitals in a word to be right when one of the following cases holds:All letters in t

2017-05-26 18:25:50 299

原创 LeetCode 136: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

2017-05-26 16:54:35 211

原创 LeetCode 485:Max Consecutive Ones(连续1的最大个数,边界条件)

Given a binary array, find the maximum number of consecutive 1s in this array.Example 1:Note:设置两个变量cons和max,分别用来统计当前连续1的个数和最大1的个数。当元素的值等于1的时候,当前连续1的个数增加1,并且判断cons是否大于max,若cons>max,max=co

2017-05-26 16:18:51 356

原创 LeetCode 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

2017-05-26 15:51:48 609

原创 LeetCode 463: Island Perimeter(岛屿周长)

问题描述:You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not diagonally). The grid is co

2017-05-25 22:07:36 650

原创 LeetCode 496: Next Greater Element I (下一个大的元素)

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-05-25 20:37:50 388 3

原创 LeetCode 344: Reverse String (字符串翻转)

Write a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh".Note:1.注意空间复杂度,不需要重新分配内存,直接在原字符串上进行操作。 2.swap()函数的使用, swap函数原型如下:

2017-05-25 16:03:33 314 3

2015年数据结构联考复习指导-王道论坛

考研必备,数据结构

2017-08-18

kaldi全部资料

语音识别搭建,kaldi全部资料

2017-08-10

空空如也

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

TA关注的人

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