Find K Closest Elements - LeetCode
Given a sorted integer array arr
, two integers k
and x
, return the k
closest integers to x
in the array. The result should also be sorted in ascending order.
Intersection of Two Arrays - LeetCode
Given two integer arrays nums1
and nums2
, return an array of their intersection. Each element in the result must be unique and you may return the result in any order.
Contains Duplicate II - LeetCode
Given an integer array nums
and an integer k
, return true
if there are two distinct indices i
and j
in the array such that nums[i] == nums[j]
and abs(i - j) <= k
.
Minimum Size Subarray Sum - LeetCode
Given an array of positive integers nums
and a positive integer target
, return the minimal length of a subarray whose sum is greater than or equal to target
. If there is no such subarray, return 0
instead.
Repeated DNA Sequences - LeetCode
The DNA sequence is composed of a series of nucleotides abbreviated as 'A'
, 'C'
, 'G'
, and 'T'
.
Longest Substring Without Repeating Characters - LeetCode
Given a string s
, find the length of the longest substring without repeating characters.
Given an array nums
of size n
, return the majority element.
The majority element is the element that appears more than [n / 2]
times. You may assume that the majority element always exists in the array.
Longest Substring with At Least K Repeating Characters - LeetCode
Given a string s
and an integer k
, return the length of the longest substring of s
such that the frequency of each character in this substring is greater than or equal to k
.