avatar
文章
197
标签
17
分类
0
首页
归档
标签
分类
关于
今是昨非的博客
首页
归档
标签
分类
关于

今是昨非的博客

Algorithem_Populating Next Right Pointers in Each Node
发表于2022-04-21
Algorithem_Populating Next Right Pointers in Each NodeYou are given a perfect binary tree where all leaves are on the same level, and every parent has two children. The binary tree has the following definition: 123456struct Node { int val; Node *left; Node *right; Node *next;} Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to NULL. Initially, all next pointers are set to NULL. Example 1: 12Input: root...
iOS 长截图
发表于2022-04-20
iOS长截图背景Twitter 上看到TaioApp的作者说,iOS 系统有支持长截图的API——UIScreenshotService,从 iOS 13开始就可以使用,下午的时候就在自己的 APP 中体验了一下。 过程UIScreenshotService官方的说明如下: When the user takes a screenshot of your app’s content, you work with a UIScreenshotService object to provide a PDF version of that screenshot. You do not create a UIScreenshotService object directly. Instead, you retrieve the object from the screenshotService property of your window scene and assign a delegate to it. When the user takes a screenshot, UI...
Algorithem_Max Area of Island
发表于2022-04-20
733. Algorithem_Max Area of IslandYou are given an m x n binary matrix grid. An island is a group of 1’s (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are surrounded by water. The area of an island is the number of cells with a value 1 in the island. Return the maximum area of an island in grid. If there is no island, return 0. Example 1: 123Input: grid = [[0,0,1,0,0,0,0,1,0,0,0,0,0],[0,0,0,0,0,0,0,1,1,1,0,0,0],[0,1,1,0,1,...
Algorithem_Depth-First Search
发表于2022-04-20
733. Flood FillAn image is represented by an m x n integer grid image where image[i][j] represents the pixel value of the image. You are also given three integers sr, sc, and newColor. You should perform a flood fill on the image starting from the pixel image[sr][sc]. To perform a flood fill, consider the starting pixel, plus any pixels connected 4-directionally to the starting pixel of the same color as the starting pixel, plus any pixels connected 4-directionally to those pixels (also wit...
Algorithem_Depth-First Search
发表于2022-04-19
Algorithem_Depth-First Search3. Longest Substring Without Repeating CharactersGiven a string s, find the length of the longest substring without repeating characters. Example 1: 123Input: s = "abcabcbb"Output: 3Explanation: The answer is "abc", with the length of 3. Example 2: 123Input: s = "bbbbb"Output: 1Explanation: The answer is "b", with the length of 1. Example 3: 1234Input: s = "pwwkew"Output: 3Explanation: The answer is "wke&q...
Algorithem_TwoPointersOfLinked List
发表于2022-04-18
Algorithem_TwoPointersOfLinked List876. Middle of the Linked ListGiven the head of a singly linked list, return the middle node of the linked list. If there are two middle nodes, return the second middle node. Example 1: 123Input: head = [1,2,3,4,5]Output: [3,4,5]Explanation: The middle node of the list is node 3. Example 2: 123Input: head = [1,2,3,4,5,6]Output: [4,5,6]Explanation: Since the list has two middle nodes with values 3 and 4, we return the second one. 解法单看例子,感觉是获取数组中间位置到末尾,这个...
Algorithem_ReverseWords
发表于2022-04-15
Algorithem_ReverseWordsReverse Words in a String IIIGiven a string s, reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order. Example 1: 12Input: s = "Let's take LeetCode contest"Output: "s'teL ekat edoCteeL tsetnoc" Example 2: 12Input: s = "God Ding"Output: "doG gniD" 解法一逻辑:把字符串根据空格切割成数组,然后遍历数组,对数组中字符串调用 reversed 方法,最后在使用空格join为字符串返回 代码如下: 12345678910111213class Solution &#...
Algorithem_TwoPointers
发表于2022-04-15
Algorithem_TwoPointersTwo Sum II - Input Array Is SortedGiven a 1-indexed array of integers numbers that is already sorted in non-decreasing order, find two numbers such that they add up to a specific target number. Let these two numbers be numbers[index1] and numbers[index2] where 1 <= index1 < index2 <= numbers.length. Return the indices of the two numbers, index1 and index2, added by one as an integer array [index1, index2] of length 2. The tests are generated such that there is e...
Algorithem_MoveZeros
发表于2022-04-14
Algorithem_MoveZerosGiven an integer array nums, move all 0’s to the end of it while maintaining the relative order of the non-zero elements. Note that you must do this in-place without making a copy of the array. Example 1: 1234Input: nums = [0,1,0,3,12]Output: [1,3,12,0,0] Example 2: 1234Input: nums = [0]Output: [0] 解法一实现逻辑: 首先把所有非0元素放到前面,并记录长度,最后从非0长度到数组尾部元素置为0 举例如下: 12345678910111213141516nums = [1, 0, 2, 3, 0, 6]j = 0 遍历数组:i = 0,nums[0] = 1, != 0, num[j] = num[i], j + 1, [1, 0, 2, ...
Algorithem_ReverseArray
发表于2022-04-14
Algorithem_ReverseArrayGiven an array, rotate the array to the right by k steps, where k is non-negative. Example 1: 12345678Input: nums = [1,2,3,4,5,6,7], k = 3Output: [5,6,7,1,2,3,4]Explanation:rotate 1 steps to the right: [7,1,2,3,4,5,6]rotate 2 steps to the right: [6,7,1,2,3,4,5]rotate 3 steps to the right: [5,6,7,1,2,3,4] Example 2: 1234567Input: nums = [-1,-100,3,99], k = 2Output: [3,99,-1,-100]Explanation: rotate 1 steps to the right: [99,-1,-100,3]rotate 2 steps to the right: [3,9...
1…91011…20
avatar
今是昨非
技术分享、生活感悟
文章
197
标签
17
分类
0
Follow Me
公告
This is my Blog
最新文章
如何构建自己的知识库——第一步2026-03-03
iOS 全局防截屏原理2026-02-28
腾讯轻量服务器 OpenClaw 实践2026-02-07
半天通过 AI 实现切换APP中广告 SDK2026-02-05
用 AI 实现了一个小需求2026-01-31
标签
books ReactNative 分享 技术 算法 标签1 movies iOS 标签2 Algorithem 生活 iOS自动打包 随笔 learning Flutter iOS蓝牙 ideas
归档
  • 三月 2026 1
  • 二月 2026 3
  • 一月 2026 8
  • 十月 2025 1
  • 九月 2025 4
  • 八月 2025 3
  • 十二月 2024 1
  • 十一月 2024 2
网站信息
文章数目 :
197
本站访客数 :
本站总浏览量 :
最后更新时间 :
© 2026 By 今是昨非框架 Hexo 5.4.0|主题 Butterfly 5.5.3
日出江花红胜火,春来江水绿如蓝,能不忆江南