摘要:
Given the head of a singly linked list, sort the list using insertion sort, and return the sorted list's head. The steps of the insertion sort algorit 阅读全文
随笔档案-2023年10月
Data structure - Sort & quick sort 小结及leetcode相关题目
2023-10-21 02:48 by Johnson_强生仔仔, 51 阅读, 收藏, 编辑
摘要:
Sort 主要有以下几种常见的sort, 面试中最有可能考的是quick sort, 关于k largest or 什么相关的。 Bubble sort Insertion sort Merge sort Quicksort Selection sort Counting sort Bucket s 阅读全文
[LeetCode] 2863. Maximum Length of Semi-Decreasing Subarrays_Medium tag: stack
2023-10-12 04:56 by Johnson_强生仔仔, 173 阅读, 收藏, 编辑
摘要:
You are given an integer array nums. Return the length of the longest semi-decreasing subarray of nums, and 0 if there are no such subarrays. A subarr 阅读全文
[LeetCode] 2434. Using a Robot to Print the Lexicographically Smallest String_Medium tag: stack
2023-10-12 02:28 by Johnson_强生仔仔, 3 阅读, 收藏, 编辑
摘要:
You are given a string s and a robot that currently holds an empty string t. Apply one of the following operations until s and t are both empty: Remov 阅读全文
[LeetCode] 2282. Number of People That Can Be Seen in a Grid_Medium tag: stack.
2023-10-11 05:59 by Johnson_强生仔仔, 13 阅读, 收藏, 编辑
摘要:
You are given an m x n 0-indexed 2D array of positive integers heights where heights[i][j] is the height of the person standing at position (i, j). A 阅读全文
[LeetCode] 1944. Number of Visible People in a Queue_Hard tag: stack
2023-10-11 05:27 by Johnson_强生仔仔, 10 阅读, 收藏, 编辑
摘要:
There are n people standing in a queue, and they numbered from 0 to n - 1 in left to right order. You are given an array heights of distinct integers 阅读全文
Data structure - Stack 小结及leetcode相关题目
2023-10-11 05:26 by Johnson_强生仔仔, 17 阅读, 收藏, 编辑
摘要:
Linear data structure - Stack O(1) for push O(1) for pop O(1) for top - Basic skills 先进后出 [LeetCode] 232. Implement Queue using Stacks_Easy tag: stack 阅读全文