![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构
Mark-Wang
菜鸟逆袭记
展开
-
LeetCode:单词拆分(Java)
给定一个非空字符串 s 和一个包含非空单词的列表 wordDict,判定 s 是否可以被空格拆分为一个或多个在字典中出现的单词。说明:拆分时可以重复使用字典中的单词。你可以假设字典中没有重复的单词。示例 1:输入: s = “leetcode”, wordDict = [“leet”, “code”]输出: true解释: 返回 true 因为 “leetcode” 可以被拆分成 “leet code”。示例 2:输入: s = “applepenapple”, wordDict = [“原创 2021-01-24 11:02:59 · 306 阅读 · 0 评论 -
LeetCode第47题:Permutations II(2020最详细版)
Given a collection of numbers that might contain duplicates, return all possible unique permutations.Example:Input: [1,1,2]Output:[[1,1,2],[1,2,1],[2,1,1]]题目解析:求取不重复的排列组合,与前一题增加了去重的难度,所以此题的关键在于如何去重;题目去重逻辑:1.增加数字是否加入排列的标识:boolean flags = new boo原创 2020-05-16 19:54:33 · 367 阅读 · 0 评论 -
Java新手学习指南(2020最新推荐版)
写给入坑Java的新手程序员Java拥有丰富且完整的生态,各类框架及工具应有尽有,系统完善的学习需花费较大精力;Java在国内互联网行业应有最为广泛,没有之一,岗位多,但是竞争也最为激烈;Java现在不缺CRUD程序员,缺精通Java的高级工程师,入坑需谨慎;Java可让你轻松在一线城市实现中国梦,也能让你难以温饱;Java开源各自框架,但是源码读起来会让你枯燥乏味。Java生态链...原创 2020-05-01 18:57:45 · 480 阅读 · 0 评论 -
LeetCode第46题:Permutations(全排列)Java详解
Given a collection of distinct integers, return all possible permutations.Example:Input: [1,2,3]Output:[[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]题目解析:就是高中学习的排列组合,给定几个数字,求出所有的组合形式;...原创 2020-04-18 12:42:57 · 425 阅读 · 1 评论 -
LeetCode第45题:Jump Game II(C++详解)
Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Your goal is to r...原创 2020-04-12 18:39:41 · 293 阅读 · 0 评论 -
LeetCode第43题:Multiply Strings(Java详解)
Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string.Example 1:Input: num1 = “2”, num2 = “3”Output: “6”Example 2:...原创 2020-03-28 11:30:37 · 139 阅读 · 0 评论 -
LeetCode第42题:Trapping Rain Water(Java详解)
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.解题思路:1.仔细看题目,就是给定个数组,某个元素小于自己左边和右边即可装水,装水是左右二边高...原创 2020-03-22 15:57:04 · 261 阅读 · 0 评论 -
LeetCode第32题:Longest Valid Parentheses(C++详解)
Longest Valid ParenthesesGiven a string containing just the characters ‘(’ and ‘)’, find the length of the longest valid (well-formed) parentheses substring.Example 1:Input: “(()”Output: 2Expla...原创 2019-10-07 17:53:30 · 205 阅读 · 0 评论 -
LeetCode第三题---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 ...原创 2019-04-16 21:43:38 · 190 阅读 · 0 评论 -
LeetCode第二题:Add Two Numbers(C++)
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ 上面是定义的结构体class Solution {public: L...原创 2019-04-09 20:52:19 · 270 阅读 · 0 评论 -
LeetCode TwoSum实例解析
互联网寒冬催生焦虑,楼主倍感压力,迫于源码晦涩难懂,于是选择LeetCode作为积累,手撕代码。LeetCode 第一题:TwoSum,题目不在复述,直接进入主题,楼主都是在VS2017中跑通过得。博客都是本人手打,难免有错误,请包涵!暴力破解法:#include <iostream>#include <stdio.h>using namespace std;i...原创 2019-04-02 21:12:56 · 324 阅读 · 0 评论 -
c++实现冒泡和快速排序(完整版)
在春天午后,阳光和煦,写一篇博客,来舒缓心情,技术积累不是一朝一夕的事,加油吧,每个不甘平庸得你。写个冒泡排序和快速排序。冒泡排序#incuede<iostream>#inclued<stdio.h>using namespace stdvoid BubbleSort(int array[],int len){ if(len ! = 0) { ...原创 2019-04-06 14:49:12 · 859 阅读 · 1 评论 -
数据结构之链表解析
单向链表逆序循环完整实现(c++语言)单向链表逆序递归完整实现(c++语言)代码实现如下(循环):#include #include using namespace std;struct linkNode{int val;linkNode *next;linkNode(int x):val(x),next(NULL){}};linkNode *reverse2(li...原创 2018-09-18 20:33:08 · 180 阅读 · 0 评论