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

今是昨非的博客

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...
Algorithem_Sort
发表于2022-04-13
Algorithem_SortGiven an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order. QuickSort实现逻辑:取指定位置的 index 的值key,比较index和 index之前的数字,如果前面的数字大于后面的数字,则交换位置; 比如: 123456789[ 8 3 5 1 4 2 ]从 index为1开始,当前元素3,前面元素8,8 > 3,故而交换位置,数组还为[ 3 8 5 1 4 2 ]然后 index 为2,当前元素为5,前面元素为8,8>5,故而交换位置,数组为[ 3 5 8 1 4 2 ]然后 index 为3,当前元素为1,前面元素为8,8>1,故而交换位置,数组为[ 3 5 1 8 4 2 ];5>1,故而交换位置,数组为[ 3 1 5 8 4 2 ];3>1,故而交换位置,数组为[ 1 3 5 8 4 2...
Algorithem_BinarySearch
发表于2022-04-12
Algorithem_BinarySearchBinarySearchGiven an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums. If target exists, then return its index. Otherwise, return -1. You must write an algorithm with O(log n) runtime complexity. Constraints:All the integers in nums are unique.nums is sorted in ascending order. 解法一开始我的想法是,从每次数组的中间 middleIndex 开始查找,比较数组中间的数字和 target 的大小,target 大则取 从middleIndex到数组结尾截取数组生成新的数组;target 小则取从0到 middle...
2022年04月经历
发表于2022-04-08
我住在上海青浦,想记录一下这次的经历。从来没想过有一天需要担心的事情:今天吃什么,家里东西够不够,今天哪里能买到菜。 由于公司在浦东,浦东街道分批排查疫情的缘故,03🈷24号开始居家办公,并没有感觉到疫情对青浦这边的影响。而后的突然通知公司里有个无症状感染者,虽然和我不在同一楼层,但公司受到影响,所以仍继续居家办公,彼时只是稍微感觉有些紧迫,但并未太在意。再接下来,就是收到浦东4天(2022年03月28日——2022年04月01日)、浦西4天(2022年04月01日——2022年04月05日)的通知,这时还在感叹终于舍得封闭了,由于还是居家办公,所以打算等浦西封闭前一天去买菜。 但是
图片中多个二维码选择的实现
发表于2022-03-29
背景买早餐的时候会遇到,支付宝和微信的二维码贴在一起,然后扫码的时候两个二维码一起被识别出来的情况。之前的处理可能是:APP内部判断 是自己的 Scheme 的时,自动跳转;后来发现变成了识别到多个二维码时,弹出二维码选择页,用户选择具体二维码后,再跳转。 公司的项目一直没有做这个功能,最近有时间,就来整理添加到项目中,这里分享记录一下实现的过程。 过程整个的过程是: 识别二维码 只有一个,则直接跳转; 有多个二维码信息,则跳转二维码选择页面; 二维码选择页面标记出每个二维码的位置; 点击对应位置的二维码,跳转对应的链接。 二维码识别二维码识别的逻辑,代码如下: 12345678910111213// UIImage + Category//识别二维码图片- (NSArray <CIFeature*> *)imageQRFeatures { CIImage *ciImage = [[CIImage alloc] initWithCGImage:self.CGImage options:nil]; CIContext *co...
1…91011…20
avatar
今是昨非
技术分享、生活感悟
文章
194
标签
17
分类
0
Follow Me
公告
This is my Blog
最新文章
半天通过 AI 实现切换APP中广告 SDK2026-02-05
用 AI 实现了一个小需求2026-01-31
紧急救援中 AI 接管 119 的感受2026-01-31
Rules、Skills、Subagents、MCP 是什么2026-01-29
CodeBuddyCN 使用免费的七牛 Model 步骤2026-01-27
标签
标签2 技术 iOS books Algorithem 随笔 learning iOS自动打包 算法 movies 标签1 生活 分享 iOS蓝牙 Flutter ReactNative ideas
归档
  • 二月 2026 1
  • 一月 2026 8
  • 十月 2025 1
  • 九月 2025 4
  • 八月 2025 3
  • 十二月 2024 1
  • 十一月 2024 2
  • 八月 2024 2
网站信息
文章数目 :
194
本站访客数 :
本站总浏览量 :
最后更新时间 :
© 2026 By 今是昨非框架 Hexo 5.4.0|主题 Butterfly 5.5.3
日出江花红胜火,春来江水绿如蓝,能不忆江南