数据结构和算法
zhuge19870104
这个作者很懒,什么都没留下…
展开
-
牛客网 - BM39 序列化二叉树 [Hard]
题目: https://www.nowcoder.com/practice/cf7e25aa97c04cc1a68c8f040e71fb84?tpId=295&tqId=23455&ru=%2Fpractice%2Fe0cc33a83afe4530bcec46eba3325116&qru=%2Fta%2Fformat-top101%2Fquestion-ranking&sourceUrl=%2Fexam%2Foj思路BFS,广度优先遍历.CMakeLists.txtmain.cpp程序输出如下,...原创 2022-07-18 11:39:27 · 238 阅读 · 0 评论 -
牛客网 BM85 合法IP
string算法,合法IP原创 2022-07-09 10:31:46 · 243 阅读 · 0 评论 -
Leetcode 75 - 颜色分类 [Medium] 三种实现方法
题目: https://leetcode.cn/problems/sort-colors/程序目录结构如下,CMakeLists.txtcmake_minimum_required(VERSION 2.6)project(sort_colors)set(CMAKE_CXX_STANDARD 20)add_definitions(-g)include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../include)string(REPLA转载 2022-05-26 15:54:56 · 139 阅读 · 0 评论 -
leetcode 4 - 寻找两个正序数组的中位数 - Hard
题目: https://leetcode.cn/problems/median-of-two-sorted-arrays/程序目录结构如下,CMakeLists.txtcmake_minimum_required(VERSION 2.6)project(median_of_2_sorted_arr)set(CMAKE_CXX_STANDARD 20)add_definitions(-g)include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../转载 2022-05-23 09:37:44 · 86 阅读 · 0 评论 -
leetcode 540 - 有序数组中的单一元素
题目: https://leetcode.cn/problems/single-element-in-a-sorted-array/程序目录结构如下,CMakeLists.txtcmake_minimum_required(VERSION 2.6)project(single_element_in_a_sorted_arr)set(CMAKE_CXX_STANDARD 20)add_definitions(-g)include_directories(${CMAKE_CURRENT_SO转载 2022-05-21 06:30:14 · 152 阅读 · 0 评论 -
leetcode 81 - 旋转数组查找数字
题目: https://leetcode.cn/problems/search-in-rotated-sorted-array-ii/submissions/程序目录结构如下:CMakeLists.txtcmake_minimum_required(VERSION 2.6)project(rotated_sorted_arr)set(CMAKE_CXX_STANDARD 20)add_definitions(-g)include_directories(${CMAKE_CURRENT_S转载 2022-05-20 11:13:24 · 162 阅读 · 0 评论 -
leetcode 34 - 在排序数组中查找元素的第一个和最后一个位置 - Medium
程序目录结构如下,CMakeLists.txtcmake_minimum_required(VERSION 2.6)project(find_first_and_last_element_in_sorted_arr)set(CMAKE_CXX_STANDARD 20)add_definitions(-g)include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../include)string(REPLACE ".cpp" "" file转载 2022-05-20 09:41:45 · 99 阅读 · 0 评论 -
leetcode 340 - 拥有k个唯一字符的最长子串 - Hard 双指针问题
题目: https://www.cnblogs.com/fatttcat/p/10302397.html程序结构如下,CMakeLists.txtcmake_minimum_required(VERSION 2.6)project(longest_substr_with_at_most_k_distinct_chars)set(CMAKE_CXX_STANDARD 20)add_definitions(-g)include_directories(${CMAKE_CURRENT_SOUR转载 2022-05-19 11:21:08 · 145 阅读 · 0 评论 -
leetcode 524 - 通过删除字母匹配到字典里最长单词
题目: https://leetcode.cn/problems/longest-word-in-dictionary-through-deleting/程序目录结构如下,CMakeLists.txtcmake_minimum_required(VERSION 2.6)project(longest_word_in_dict_through_deleting)set(CMAKE_CXX_STANDARD 20)add_definitions(-g)include_directories(转载 2022-05-19 09:57:20 · 89 阅读 · 0 评论 -
leetcode 76 - 最小覆盖子串[滑动窗口] Hard
题目: https://leetcode.cn/problems/minimum-window-substring/程序目录结构如下,CMakeLists.txtcmake_minimum_required(VERSION 2.6)project(minimum_window_substr)set(CMAKE_CXX_STANDARD 20)add_definitions(-g)include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../.转载 2022-05-18 19:35:10 · 102 阅读 · 0 评论 -
leetcode 88 - 合并两个有序数组的三种解法
题目: https://leetcode.cn/problems/merge-sorted-array/submissions/都是官方的解答。照着答案领悟了一遍,现在觉得确实在那一堆坑里面算简单的题目。程序代码结构如下,CMakeLists.txtcmake_minimum_required(VERSION 2.6)project(merge_sorted_array)set(CMAKE_CXX_STANDARD 20)add_definitions(-g)include_direc转载 2022-05-18 14:47:22 · 119 阅读 · 0 评论 -
C++ 指针常量和常量指针剖析
反着指针符号看,刚好通。程序结构如下,CMakeLists.txtcmake_minimum_required(VERSION 2.6)project(const_pointers)set(CMAKE_CXX_STANDARD 20)add_definitions(-g)include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../include)string(REPLACE ".cpp" "" file "main.cpp")add原创 2022-05-18 11:27:14 · 194 阅读 · 0 评论 -
leetcode 406 - 根据身高重建队列
题目: https://leetcode.cn/problems/queue-reconstruction-by-height/程序的结构如下,CMakeLists.txtcmake_minimum_required(VERSION 2.6)project(queue_reconstruction_by_height)set(CMAKE_CXX_STANDARD 20)add_definitions(-g)include_directories(${CMAKE_CURRENT_SOURCE转载 2022-05-17 15:53:22 · 94 阅读 · 0 评论 -
leetcode 763-划分字母区间
题目: https://leetcode.cn/problems/partition-labels/本例使用题解中的贪心算法。并加了一些注释。程序结构如下,CMakeLists.txtcmake_minimum_required(VERSION 2.6)project(partition_labels)set(CMAKE_CXX_STANDARD 20)add_definitions(-g)string(REPLACE ".cpp" "" file "main.cpp")add_ex转载 2022-05-17 13:35:45 · 89 阅读 · 0 评论 -
leetcode 452 用最少数量的箭引爆气球
本例也是直接照抄答案,再加了一点注释。程序的目录结构如下,CMakeLists.txtcmake_minimum_required(VERSION 2.6)project(find_min_arrow_shots)set(CMAKE_CXX_STANDARD 20)add_definitions(-g)string(REPLACE ".cpp" "" file "main.cpp")add_executable(${file} "main.cpp")main.cpp#inclu转载 2022-05-17 11:34:30 · 102 阅读 · 0 评论 -
Leetcode 605-种花问题
题目描述如下。本文是直接按照官方题解做的解答。但是加了注释。程序结构如下,CMakeLists.txtcmake_minimum_required(VERSION 2.6)project(can_place_flowers)set(CMAKE_CXX_STANDARD 20)add_definitions(-g)string(REPLACE ".cpp" "" file "main.cpp")add_executable(${file} "main.cpp")main.cpp转载 2022-05-17 10:39:19 · 107 阅读 · 0 评论