You are given an integer array nums. You are initially positioned at the array’s first index, and each element in the array represents…
My memo and playground
You are given an integer array nums. You are initially positioned at the array’s first index, and each element in the array represents…
You are given an integer array prices where prices[i] is the price of a given stock on the ith day. On each day, you may…
You are given an array prices where prices[i] is the price of a given stock on the ith day. You want to maximize your pr…
Given an integer array nums, rotate the array to the right by k steps, where k is non-negative. Input: nums = [1,2,3,4,5,6,7], k = 3 Output: [5,6,7,1,…
Given an array nums of size n, return the majority element. The majority element is the element that appears more than ⌊n / 2⌋ tim…
Given an integer array nums sorted in non-decreasing order, remove some duplicates in-place such that each unique element app…
Given an integer array nums sorted in non-decreasing order, remove the duplicates in-place such that each unique element appe…
Given an integer array nums and an integer val, remove all occurrences of val in nums in-place. The order of the el…
Given two strings needle and haystack, return the index of the first occurrence of needle in haystack, or -1 i…
You are given two integer arrays nums1 and nums2, sorted in non-decreasing order, and two integers m and n, represe…