自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(84)
  • 资源 (5)
  • 收藏
  • 关注

原创 快手笔试题Leetcode165

比较两个版本号 version1 和 version2。如果 version1 > version2 返回 1,如果 version1 < version2 返回 -1, 除此之外返回 0。你可以假设版本字符串非空,并且只包含数字和 . 字符。. 字符不代表小数点,而是用于分隔数字序列。例如,2.5 不是“两个半”,也不是“差一半到三”,而是第二版中的第五个小版本。你可以假...

2019-08-25 19:13:56 478

原创 Leetcode101. Symmetric Tree

给定一个二叉树,检查它是否是镜像对称的。例如,二叉树 [1,2,2,3,4,4,3] 是对称的。1/ 2 2/ \ / 3 4 4 3但是下面这个 [1,2,2,null,3,null,3] 则不是镜像对称的:1/ 2 2\ 3 3说明:如果你可以运用递归和迭代两种方法解决这个问题,会很加分。来源:力扣(LeetCode)链接:https://...

2019-08-17 03:18:01 147

原创 Leetcode509. Fibonacci Number

斐波那契数,通常用 F(n) 表示,形成的序列称为斐波那契数列。该数列由 0 和 1 开始,后面的每一项数字都是前面两项数字的和。也就是:F(0) = 0, F(1) = 1 F(N) = F(N - 1) + F(N - 2), 其中 N > 1. 给定 N,计算F(N)。示例 1:输入:2 输出:1 解释:F(2) = F(1) + F(0) = 1 + 0 = 1. 示例...

2019-08-17 00:51:26 138

原创 Leetcode127. Word Ladder

给定两个单词(beginWord 和 endWord)和一个字典,找到从 beginWord 到 endWord的最短转换序列的长度。转换需遵循如下规则:每次转换只能改变一个字母。 转换过程中的中间单词必须是字典中的单词。 说明:如果不存在这样的转换序列,返回 0。 所有单词具有相同的长度。 所有单词只由小写字母组成。 字典中不存在重复的单词。 你可以假设beginWord 和 endW...

2019-08-15 04:13:24 116

原创 Leetcode451. Sort Characters By Frequency

给定一个字符串,请将字符串里的字符按照出现的频率降序排列。示例 1:输入: “tree”输出: “eert”解释: 'e’出现两次,'r’和’t’都只出现一次。 因此’e’必须出现在’r’和’t’之前。此外,"eetr"也是一个有效的答案。 示例2:输入: “cccaaa”输出: “cccaaa”解释: 'c’和’a’都出现三次。此外,"aaaccc"也是有效的答案。 注意"ca...

2019-08-13 02:05:45 122

原创 Leetcode75. Sort Colors

给定一个包含红色、白色和蓝色,一共 n 个元素的数组,原地对它们进行排序,使得相同颜色的元素相邻,并按照红色、白色、蓝色顺序排列。此题中,我们使用整数 0、 1 和 2 分别表示红色、白色和蓝色。注意: 不能使用代码库中的排序函数来解决这道题。示例:输入: [2,0,2,1,1,0] 输出: [0,0,1,1,2,2] 进阶:一个直观的解决方案是使用计数排序的两趟扫描算法。 首先,迭代...

2019-08-13 02:01:46 88

原创 Leetcode215. Kth Largest Element in an Array

在未排序的数组中找到第 k 个最大的元素。请注意,你需要找的是数组排序后的第 k 个最大的元素,而不是第 k 个不同的元素。示例 1:输入: [3,2,1,5,6,4] 和 k = 2 输出: 5 示例 2:输入: [3,2,3,1,2,4,5,5,6] 和 k = 4 输出: 4 说明:你可以假设 k 总是有效的,且 1 ≤ k ≤ 数组的长度。来源:力扣(LeetCode)链接:...

2019-08-12 03:13:33 89

原创 Leetcode524. Longest Word in Dictionary through Deleting

给定一个字符串和一个字符串字典,找到字典里面最长的字符串,该字符串可以通过删除给定字符串的某些字符来得到。如果答案不止一个,返回长度最长且字典顺序最小的字符串。如果答案不存在,则返回空字符串。示例 1:输入: s = “abpcplea”, d = [“ale”,“apple”,“monkey”,“plea”]输出: “apple” 示例 2:输入: s = “abpcplea”, d...

2019-08-12 02:01:44 112

原创 Leetcode141. Linked List Cycle

给定一个链表,判断链表中是否有环。为了表示给定链表中的环,我们使用整数 pos 来表示链表尾连接到链表中的位置(索引从 0 开始)。 如果 pos 是-1,则在该链表中没有环。示例 1:输入:head = [3,2,0,-4], pos = 1 输出:true 解释:链表中有一个环,其尾部连接到第二个节点。 示例 2:输入:head = [1,2], pos = 0 输出:true ...

2019-08-12 00:52:16 74

原创 Leetcode88. Merge Sorted Array

给定两个有序整数数组 nums1 和 nums2,将 nums2 合并到 nums1 中,使得 num1 成为一个有序数组。说明:初始化 nums1 和 nums2 的元素数量分别为 m 和 n。 你可以假设 nums1 有足够的空间(空间大小大于或等于 m +n)来保存 nums2 中的元素。 示例:输入: nums1 = [1,2,3,0,0,0], m = 3 nums2 = [2...

2019-08-12 00:28:56 72

原创 Leetcode680. Valid Palindrome II

Given a non-empty string s, you may delete at most one character.Judge whether you can make it a palindrome.Example 1: Input: “aba” Output: True Example 2: Input: “abca” Output:True Explanation: Y...

2019-08-11 02:31:26 79

原创 Leetcode345. Reverse Vowels of a String

Write a function that takes a string as input and reverse only thevowels of a string.Example 1:Input: “hello” Output: “holle” Example 2:Input: “leetcode” Output: “leotcede” Note: The vowels does ...

2019-08-11 01:28:51 91

原创 Leetcode633. Sum of Square Numbers

Given a non-negative integer c, your task is to decide whetherthere’re two integers a and b such that a2 + b2 = c.Example 1:Input: 5 Output: True Explanation: 1 * 1 + 2 * 2 = 5Example 2:Input: 3...

2019-08-11 01:11:43 83

原创 Leetcode167. 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 the two numbers ...

2019-08-11 00:45:52 64

原创 Leetcode494. Target Sum

You are given a list of non-negative integers, a1, a2, …, an, and atarget, S. Now you have 2 symbols + and -. For each integer, youshould choose one from + and - as its new symbol.Find out how man...

2019-08-05 23:46:29 85

原创 Leetcode647. Palindromic Substrings

Given a string, your task is to count how many palindromic substringsin this string.The substrings with different start indexes or end indexes are countedas different substrings even they consist ...

2019-08-05 21:22:38 58

原创 Leetcode338. Counting Bits

Given a non negative integer number num. For every numbers i in therange 0 ≤ i ≤ num calculate the number of 1’s in their binaryrepresentation and return them as an array.Example 1:Input: 2 Outpu...

2019-08-05 20:28:37 75

原创 Leetcode322. Coin Change

You are given coins of different denominations and a total amount ofmoney amount. Write a function to compute the fewest number of coinsthat you need to make up that amount. If that amount of money...

2019-08-05 19:47:38 76

原创 Leetcode309. Best Time to Buy and Sell Stock with Cooldown

Say you have an array for which the ith element is the price of agiven stock on day i.Design an algorithm to find the maximum profit. You may complete asmany transactions as you like (ie, buy one ...

2019-08-05 17:47:19 72

原创 Leetcode300. Longest Increasing Subsequence

Given an unsorted array of integers, find the length of longestincreasing subsequence.Example:Input: [10,9,2,5,3,7,101,18] Output: 4 Explanation: The longestincreasing subsequence is [2,3,7,101]...

2019-08-05 16:40:54 74

原创 Leetcode279. Perfect Squares

Given a positive integer n, find the least number of perfect squarenumbers (for example, 1, 4, 9, 16, …) which sum to n.Example 1:Input: n = 12 Output: 3 Explanation: 12 = 4 + 4 + 4. Example 2:I...

2019-08-05 15:31:11 56

原创 Leetcode221. Maximal Square

Given a 2D binary matrix filled with 0’s and 1’s, find the largestsquare containing only 1’s and return its area.Example:Input:1 0 1 0 01 0 1 1 11 1 1 1 11 0 0 1 0Output: 4动态规划20msclass ...

2019-08-04 19:17:56 82

原创 Leetcode198. House Robber

You are a professional robber planning to rob houses along a street.Each house has a certain amount of money stashed, the only constraintstopping you from robbing each of them is that adjacent hous...

2019-08-04 18:10:16 61

原创 Leetcode152. Maximum Product Subarray

Given an integer array nums, find the contiguous subarray within anarray (containing at least one number) which has the largest product.Example 1:Input: [2,3,-2,4] Output: 6 Explanation: [2,3] has...

2019-08-04 17:34:27 70

原创 Leetcode139. Word Break

Given a non-empty string s and a dictionary wordDict containing a listof non-empty words, determine if s can be segmented into aspace-separated sequence of one or more dictionary words.Note:The s...

2019-08-04 16:09:39 54

原创 Leetcod91. Decode Ways

A message containing letters from A-Z is being encoded to numbersusing the following mapping:‘A’ -> 1 ‘B’ -> 2 … ‘Z’ -> 26 Given a non-empty string containingonly digits, determine the to...

2019-07-31 17:38:54 70

原创 Leetcode121. Best Time to Buy and Sell Stock

Say you have an array for which the ith element is the price of agiven stock on day i.If you were only permitted to complete at most one transaction (i.e.,buy one and sell one share of the stock),...

2019-07-31 14:12:59 58

原创 Leetcode96. Unique Binary Search Trees

Given n, how many structurally unique BST’s (binary search trees) thatstore values 1 … n?Example:Input: 3 Output: 5 Explanation: Given n = 3, there are a total of 5unique BST’s:1 3 3...

2019-07-31 13:11:40 51

原创 Leetcode70. Climbing Stairs

You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct wayscan you climb to the top?Note: Given n will be a positive ...

2019-07-30 21:54:00 55

原创 Leetcode92. Reverse Linked List II

Reverse a linked list from position m to n. Do it in one-pass.Note: 1 ≤ m ≤ n ≤ length of list.Example:Input: 1->2->3->4->5->NULL, m = 2, n = 4 Output: 1->4->3->2->5-&gt...

2019-07-30 21:33:35 61

原创 Leetcode206. Reverse Linked List

Reverse a singly linked list.Example:Input: 1->2->3->4->5->NULL Output: 5->4->3->2->1->NULL Follow up:A linked list can be reversed either iteratively or recursively....

2019-07-30 19:44:17 62

原创 Leetcode64. Minimum Path Sum

Given a m x n grid filled with non-negative numbers, find a path fromtop left to bottom right which minimizes the sum of all numbers alongits path.Note: You can only move either down or right at a...

2019-07-30 16:48:41 52

原创 Leetcode63. Unique Paths II

A robot is located at the top-left corner of a m x n grid (marked‘Start’ in the diagram below).The robot can only move either down or right at any point in time. Therobot is trying to reach the bo...

2019-07-30 16:43:14 51

原创 Leetcode 62. Unique Paths

A robot is located at the top-left corner of a m x n grid (marked‘Start’ in the diagram below).The robot can only move either down or right at any point in time. Therobot is trying to reach the bo...

2019-07-29 22:18:16 55

原创 Leetcode53 Maximum Subarray

Given an integer array nums, find the contiguous subarray (containingat least one number) which has the largest sum and return its sum.Example:Input: [-2,1,-3,4,-1,2,1,-5,4], Output: 6 Explanation...

2019-07-29 20:50:44 77

原创 C++ memset初始化为0/-1

1、对于字符数组,可以将其初始化为任意一个字符2、对int数组只能初始化0和-1memset(dp, 1, len*sizeof(dp));无法初始化

2019-07-29 16:46:59 1112

原创 Leetcode 5. 最长回文子串

给定一个字符串 s,找到 s 中最长的回文子串。你可以假设 s 的最大长度为 1000。示例 1:输入: “babad” 输出: “bab” 注意: “aba” 也是一个有效答案。 示例 2:输入: “cbbd” 输出: “bb”来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/longest-palindromic-substrin...

2019-07-28 14:39:55 66

转载 [转]Leetcode刷题指南和top100题目

https://blog.csdn.net/lingpy/article/details/88085446

2019-07-26 20:52:06 268

转载 C++关键字

注:上表中为C++98/03中的63个关键字,其中红色标注为C语言中的32个关键字。C++11中有73个关键字,新增加的10个为:alignas、alignof、char16_t、char32_t、constexpr、decltype、noexpect、nullptr、static_assert、thread_local以下是对部分关键字的解释:1、asm_asm是一个语句的分隔符。不能单独...

2019-07-25 19:27:52 121

转载 [转]C语言运算符优先级 快速记忆

初等单目一二级, // 初等运算符和单目运算符分别是第1、2优先级乘除求余加减移, // 这句里面的运算符全归为算术运算符,移表示移位关系等于不等于, // 关系运算符(< <= > >=)按位与来异或或, // 位运算符优先级顺序: & -> ^ -> |逻辑与或条件弱, // 逻辑运算符优先级顺序: && -> |...

2019-07-24 19:33:16 91

Visual Assist X 2018.rar

Visual Assist X 支持vs2015 win10 使用2015的朋友,因为2015以及更新版本中的Visual Assist X是使用Extension的方式安装的,所以你得到这个路径去破解, 就是把破解补丁拷贝到这个路径下,直接运行补丁程序或者覆盖VA_X.dll 即可:

2019-05-27

Runge_Kutta法解初值问题

西交大计算方法上机可用。RK-4 该算法用Runge-Kutta 法解初值问题。a,b—求解区间的左右端点,y 0 —初 值,步长选用h。依次由公式计算出K1,K2,K3,K4 的值并计算出出每步的y(n)。 同时每算依次就更新依次t(n)的取值,最终输出t i 和y

2018-01-11

三次样条插值子程序

西交大计算方法作业可用。 三次样条插值子程序。 输出三次样条多项式。

2018-01-11

追赶法求解带状矩阵

带状矩阵方程组矩阵求解。 追赶法。 生成方程组的系数i u 及其除数i d ,事实上,按式(*)可交替生成i d 与i u :

2018-01-11

列主元高斯消去法

列主元高斯消去法。不是子程序。 构造增广矩阵。 消去法的核心是降维,即将求解 n元方程组的问题转化为先解 n-1元方程 组,一旦 n-1元

2018-01-11

空空如也

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

TA关注的人

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