- 博客(18)
- 资源 (1)
- 收藏
- 关注
原创 LeeCode(124) 二叉树中的最大路径和 C++
给定一个非空二叉树,返回其最大路径和。本题中,路径被定义为一条从树中任意节点出发,达到任意节点的序列。该路径至少包含一个节点,且不一定经过根节点输入: [1,2,3] 1 / \ 2 3输出: 6思路:对于一个根节点,其最大值max()有三种情况:1. result = val2. result = val + max(left)3. result = vla + ...
2019-12-21 16:15:26
211
转载 CentOS获取内核源码
CentOs 默认情况下是没有内核源码的,如果获取,并部署在usr/src/kernel/ 文件夹下的话,可以直接运行 yum install kernel yum install kernel-devel yum install kernel-headers运行时可以在目录/usr/src/kernel/ 下直接运行,之后内核源码就会出现在/usr/src/kernel/目录下如果是...
2019-07-15 14:03:27
1056
原创 LeeCode(234) Palindrome Linked List C语言
题目:Given a singly linked list, determine if it is a palindrome.Example 1:Input: 1->2Output: falseExample 2:Input: 1->2->2->1Output: trueFollow up:Could you do it in O(n) time and ...
2019-06-03 13:48:27
184
原创 LeeCode(9) Palindrome Number C语言
题目:Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.Example 1:Input: 121Output: trueExample 2:Input: -121Output: falseExplana...
2019-06-01 13:34:38
164
原创 Leecode(8) String to Integer (atoi) C语言
题目:Implement atoi which converts a string to an integer.The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from ...
2019-05-31 14:12:07
158
原创 LeeCode(7) Reverse Integer C语言
题目:Given a 32-bit signed integer, reverse digits of an integer.Example 1:Input: 123Output: 321Example 2:Input: -123Output: -321Example 3:Input: 120Output: 21Note:Assume we are dealing with...
2019-05-30 11:53:28
164
原创 LeeCode(6) ZigZag Conversion C语言
题目The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P L S I ...
2019-05-29 17:30:11
118
原创 LeeCode(5) Longest Palindromic Substring C语言
题目: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.Exam...
2019-05-27 16:40:02
192
原创 LeeCode(4) Median of Two Sorted Arrays C语言版本
题目: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...
2019-05-26 13:00:07
170
原创 LeeCode(3) Longest Substring Without Repeating Characters C语言
题目:Given a string, find the length of the longest substring without repeating characters.Example 1:Input: “abcabcbb”Output: 3Explanation: The answer is “abc”, with the length of 3.Example 2:Inp...
2019-05-25 14:02:56
173
原创 LeeCode(2) Add Two Numbers C语言 版本
题目: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 retu...
2019-05-24 13:34:32
203
原创 LeeCode(1) two sum C语言 C++版本
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 e...
2019-05-23 14:58:07
132
原创 Windows下,在C++中执行exe,以及执行命令的一些方法
Windows下,在C++中执行exe,以及执行命令有其中一下几种方法:(1)system(2)ShellExecute(3)CreateProcess(4)使用通道一、使用system这个都比较熟悉,直接system(“cmd”);即可二、使用shellExecuteint ret = (int)ShellExecute(NULL, L"", L"fortemp.exe",NUL...
2019-04-22 15:31:04
4469
原创 vs2017 将参数从“const char *”转换为“LPCWSTR”
在设置ShellEXecute中 有需要参数类型为 LPCWSTR此时可以通过设置字符集完成,具体步骤为:项目-》配置属性-》常规-》字符集-》使用多字节字符集 即可完成如果还是有问题 则需要查看项目-》配置属性-》C/C+±》预处理器-》预处理器定义 中时候是否含有Unicode通常情况一下为Unicode字符集,但是当用到windows调用时,就会使用多字节字符集。多字节字符集可能...
2019-04-12 22:20:17
736
1
原创 在堆栈中对调用函数过程的分析
首先,在调用函数是,将主函数的所用数据压入栈中,然后如果调用函数,使用逆序的方式,将函数参数压入栈中。然后将函数返回时所要返回的地址,即主函数后续执行命令的地址压入栈中。之后将旧的sp指针压入栈中,将当前的sp指针指向的地址放入sp地址寄存中。随后,将调用函数的数据以及所用寄存器压入栈中。在link阶段栈中所有的指代函数的符号将会被替换为真实的地址,之后继续执行。...
2019-03-17 12:52:54
221
原创 编译原理——词法分析
词法分析通常包含一下几个方面正则表达式有穷自动机生成NFANFA可以通过子集构造法生成DFA使用不同的方法生成的DFA不同通过使用nullable firstpos lastpos函数可以将DFA转换为最小状态的DFA,需要用的状态划分状态划分可以用通过接受状态和不可接受状态划分最小状态的DFA是唯一的...
2019-02-28 21:42:16
213
原创 git push 提交远程仓库遇到的问题 以及not fast forward 问题的解决
在远程仓库创建分支后,在本地 用git branch -a 查询 此时并没有新建的 远程仓库 branch_xie此时 需要使用 git fetch 拉取一下 获得远程仓库的所有分支,然后在使用 git branch -a 就会获得所有分支此时由于远程的master 分支 和branch_xie 分支 都不是 最新的分支,而且 我已经在本地修改了许多 ,此时如果使用git push...
2019-01-08 20:48:25
2669
NLPIR以及论文数据库语句
2018-12-21
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人