随笔分类 - LeetCode
摘要:问题: Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra spac
阅读全文
摘要:题目 Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note:You may assume that nums1 has enough space (size
阅读全文
摘要:问题 Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transact
阅读全文
摘要:问题: Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note:You may assume that nums1 has enough space (size
阅读全文
摘要:问题: Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].
阅读全文
摘要:题目: Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that
阅读全文
摘要:class Solution {public: bool containsNearbyDuplicate(vector<int>& nums, int k) { int len=nums.size(); bool flag=false; multimap<int ,int> mulm; for(in
阅读全文
浙公网安备 33010602011771号