学会思考
刻意练习
上一页 1 2 3 4 5 6 ··· 22 下一页
摘要: /** * references: * https://www.cnblogs.com/grandyang/p/7608976.html * @brief The Solution class * Given an unsorted array of integers, find the lengt 阅读全文
posted @ 2020-03-12 15:22 Worty 阅读(156) 评论(0) 推荐(0) 编辑
摘要: /** * @brief The Solution class * Given a matrix A, return the transpose of A. The transpose of a matrix is the matrix flipped over it's main diagonal 阅读全文
posted @ 2020-03-12 14:45 Worty 阅读(389) 评论(0) 推荐(0) 编辑
摘要: /**参考: https://www.cnblogs.com/grandyang/p/7084957.html * @brief The Solution class * Given an integer array, find three numbers whose product is maxi 阅读全文
posted @ 2020-03-12 14:15 Worty 阅读(179) 评论(0) 推荐(0) 编辑
摘要: Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Input: [1,1,0,1,1,1] Output: 3 Explanation: The first two di 阅读全文
posted @ 2020-03-12 11:39 Worty 阅读(169) 评论(0) 推荐(0) 编辑
摘要: //solution1 /** //references:https://www.cnblogs.com/grandyang/p/6209746.html */ class Solution1{ public: vector<int> findDuplicates(vector<int>& nums 阅读全文
posted @ 2020-03-12 11:22 Worty 阅读(155) 评论(0) 推荐(0) 编辑
摘要: Find All Numbers Disappeared in an Array 题目描述 Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others 阅读全文
posted @ 2020-03-12 10:11 Worty 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 参考: https://blog.csdn.net/musechipin/article/details/85273856 题目描述:https://leetcode.com/problems/remove-duplicates-from-sorted-array/ class Solution{ 阅读全文
posted @ 2020-03-11 15:02 Worty 阅读(298) 评论(0) 推荐(0) 编辑
摘要: /** * @brief 给定一个数组nums,将所有的0移动到数组的末尾,同时保留非0元素的相对顺序; * @param nums */ void moveZeros(vector<int>& nums){ int i = 0,poz = 0; for(int i = 0; i < nums.si 阅读全文
posted @ 2020-03-11 14:12 Worty 阅读(1240) 评论(1) 推荐(0) 编辑
摘要: /** * @brief Given an array of integers and an integer k, find out whether there are two distinct indices i and j * in the array such that nums[i]=num 阅读全文
posted @ 2020-03-10 17:08 Worty 阅读(217) 评论(0) 推荐(0) 编辑
摘要: 题目描述给定一个数组,将数组中的元素向右移动 k 个位置,其中 k 是非负数。 示例 1:输入: [1,2,3,4,5,6,7] 和 k = 3输出: [5,6,7,1,2,3,4]解释:向右旋转 1 步: [7,1,2,3,4,5,6]向右旋转 2 步: [6,7,1,2,3,4,5]向右旋转 3 阅读全文
posted @ 2020-03-09 17:22 Worty 阅读(293) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 22 下一页