自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Leetcode题目汇总(持续更新)

一开始想写Pat甲上的题,但Pat甲上的题考查太单一了,大部分是一些数据结构、图的题,听说Leetcode不错,就刷这个了,发现这个OJ和其它的OJ不太一样,以函数的形式提交题目,样例不能在本地测了,以下每一道题的代码都会有C和Java两份,其实刷算法题用什么语言都大同小异。更新的会非常慢。。。。。1.Two Sum2.Add Two Numbers3.Longest Substrin...

2018-11-13 18:38:27 647

原创 [LeetCode ] Weekly Contest 112

Minimum Increment to Make Array UniqueGiven an array of integers A, a move consists of choosing any A[i], and incrementing it by 1.Return the least number of moves to make every value in A unique...

2018-11-27 11:14:47 186

原创 [LeetCode ] Best Time to Buy and Sell Stock系列题解

这一系列的题目的基本模型是给出n天每天股票的价格,可以在任意一天买股票,在之后的任意一天把股票卖出,赚取差价,限制是手中最多有一张股票,必选把手中的股票卖掉才能再买股票。求最大获利。题目1:Best Time to Buy and Sell Stock这是最简单的一道题,在基本模型的基础上添加了一个限制条件,最多交易一次。我们从第一天开始遍历,维护一个已经遍历过的股票的最小价格mi...

2018-11-24 21:02:21 345

原创 [LeetCode ] Number of Islands

Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assum...

2018-11-22 14:14:25 217

原创 [LeetCode ] Basic Calculator

Implement a basic calculator to evaluate a simple expression string.The expression string may contain open ( and closing parentheses ), the plus + or minus sign -, non-negative integers and empty s...

2018-11-22 09:02:41 226

原创 [LeetCode ] Minimum Absolute Difference in BST

Given a binary search tree with non-negative values, find the minimum absolute difference between values of any two nodes.Example:Input: 1 \ 3 / 2Output:1Explanation:T...

2018-11-20 11:04:41 167

原创 [LeetCode ] Weekly Contest 111

 Valid Mountain ArrayGiven an array A of integers, return true if and only if it is a valid mountain array.Recall that A is a mountain array if and only if:A.length >= 3 There exists some i...

2018-11-18 19:07:33 335

原创 [LeetCode ] Long Pressed Name

Your friend is typing his name into a keyboard.  Sometimes, when typing a character c, the key might get long pressed, and the character will be typed 1 or more times.You examine the typed characte...

2018-11-17 10:00:31 209

原创 [LeetCode ] H-Index

Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index.According to the definition of h-index on Wikipedia: "A s...

2018-11-17 09:18:48 260

原创 [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.Example:Input: [0,1,0,3,12]Output: [1,3,12,0,0]Note:You...

2018-11-16 15:31:27 158

原创 [LeetCode ] Valid Anagram

Given two strings s and t , write a function to determine if t is an anagram of s.Example 1:Input: s = "anagram", t = "nagaram"Output: trueExample 2:Input: s = "rat", t = "car"Output: f...

2018-11-16 14:45:39 146

原创 [LeetCode ]Longest Palindromic Substring

Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example 1:Input: "babad"Output: "bab"Note: "aba" is also a valid answer.E...

2018-11-15 19:12:10 214

原创 [LeetCode] Median of Two Sorted Arrays

There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).You may assume nums1 and ...

2018-11-14 19:44:50 204

原创 [LeetCode] Longest Substring Without Repeating Characters

Given a string, find the length of the longest substring without repeating characters.Example 1:Input: "abcabcbb"Output: 3 Explanation: The answer is "abc", with the length of 3. Example 2:...

2018-11-14 19:09:59 225

原创 [LeetCode] 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, and you may not use the same...

2018-11-13 17:13:34 185

原创 [LeetCode] Add Two Numbers(链表合并+模拟加法)

You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return ...

2018-11-13 17:08:10 369

原创 《C专家编程》:运动的诗章:运行时数据结构

代码和数据的区别可以认为是编译时和运行时的分界线。编译器的绝大部分工作都跟翻译代码有关,必要的数据存储管理的绝大部分都在运行时进行从本质上来说,段是正在执行的程序中是一块内存区域,每个区域都有特定的目的下面我们来简单归纳一下进程对应的内存空间中所包含的5种不同的数据区都是干嘛的。bss段:bss段通常是指用来存放程序中未初始化的全局变量的一块区域。bss英文Block starte...

2018-11-12 09:49:40 186

原创 警惕Interpositioning

Interpositioning就是通过编写与库函数同名的函数来取代该函数的行为。它可以使库函数在特定的程序中被同名的用户函数所取代,通常是用于调试或为了提高效率使用Interpositioning格外小心。很容易发生自己代码中某个符号的定义取代函数库中的相同符号的意外。不仅你自己所进行的所有对该函数的调用将被自己的版本的函数调用所取代,而且所有调用该库函数的系统调用也将用你的函数取而代之。...

2018-11-10 11:16:13 269

原创 《C专家编程》:对链接的思考

可执行程序产生的的流程绝大多数编译器并不是一个单一的庞大程序。它们通常由多达六七个稍小的程序所组成,这些程序由一个叫“编译器驱动器”的控制程序来调用。这些可以方便的从编译器中分离的单独程序包括:预处理器、语法和语义检查器、代码生成器、汇编程序、优化器、链接器。链接器:"a linker or link editor is a computer utility program ...

2018-11-10 10:51:10 267

原创 耦合与内聚

耦合耦合性(Coupling),也叫耦合度,是对模块间关联程度的度量。耦合的强弱取决于模块间接口的复杂性、调用模块的方式以及通过界面传送数据的多少。数据耦合数据耦合指两个模块之间有调用关系,传递的是简单的数据值,相当于高级语言的值传递.数据耦合联系简单,耦合度低,模块独立性好,模块间的影响最小,是最理想的一种耦合形式。控制耦合控制耦合(control coupling)指一...

2018-11-01 17:28:45 1061

空空如也

空空如也

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

TA关注的人

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