随笔分类 -  算法

本分类用于存放一些算法题,主要来源于Leetcode。
摘要:题目 Write a function that reverses a string. The input string is given as an array of characters s. You must do this by modifying the input array in-pl 阅读全文
posted @ 2022-02-25 21:49 frankming 阅读(26) 评论(0) 推荐(0)
摘要:题目 Given 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 阅读全文
posted @ 2022-02-25 00:31 frankming 阅读(44) 评论(0) 推荐(0)
摘要:题目 Given 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 thi 阅读全文
posted @ 2022-02-25 00:12 frankming 阅读(34) 评论(0) 推荐(0)
摘要:题目 Given an array, rotate the array to the right by k steps, where k is non-negative. Example 1: Input: nums = [1,2,3,4,5,6,7], k = 3 Output: [5,6,7,1 阅读全文
posted @ 2022-02-24 23:52 frankming 阅读(25) 评论(0) 推荐(0)
摘要:题目 Given an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order. Example 1 阅读全文
posted @ 2022-02-24 00:21 frankming 阅读(31) 评论(0) 推荐(0)
摘要:题目 Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be i 阅读全文
posted @ 2022-02-23 00:21 frankming 阅读(25) 评论(0) 推荐(0)
摘要:题目 You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the qualit 阅读全文
posted @ 2022-02-23 00:06 frankming 阅读(24) 评论(0) 推荐(0)
摘要:题目 Given 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 exi 阅读全文
posted @ 2022-02-22 23:40 frankming 阅读(37) 评论(0) 推荐(0)
摘要:题目 Calculate a + b Input The input will consist of a series of pairs of integers a and b,separated by a space, one pair of integers per line. Output F 阅读全文
posted @ 2022-02-14 15:16 frankming 阅读(127) 评论(0) 推荐(0)
摘要:题目 Chenjb is the task author of the 71-st Zhejiang Provincial Collegiate Programming Contest. He created an NP-Hard problem on a graph with n vertices 阅读全文
posted @ 2022-02-12 16:56 frankming 阅读(217) 评论(0) 推荐(0)