Gist

Below you will find pages that utilize the term “Gist”
February 17, 2024
Find K Closest Elements - LeetCode : Swift

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.

February 15, 2024
Intersection of Two Arrays - LeetCode : Swift

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.

February 9, 2024
Contains Duplicate II - LeetCode : Swift

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.

February 9, 2024
Minimum Size Subarray Sum - LeetCode : Swift

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.

February 9, 2024
Repeated DNA Sequences - LeetCode : Swift

Repeated DNA Sequences - LeetCode

The DNA sequence is composed of a series of nucleotides abbreviated as 'A', 'C', 'G', and 'T'.

February 3, 2024
Longest Substring Without Repeating Characters - LeetCode : Swift

Longest Substring Without Repeating Characters - LeetCode

Given a string s, find the length of the longest substring without repeating characters.

January 31, 2024
Majority Element - LeetCode : Swift

Majority Element - LeetCode

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.

January 25, 2024
Longest Substring with At Least K Repeating Characters - LeetCode : Swift

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.

September 15, 2023
Search Insert Position - LeetCode : Swift

Search Insert Position - LeetCode

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 if it were inserted in order.

September 14, 2023
Find Peak Element - LeetCode : Swift

Find Peak Element - LeetCode

A peak element is an element that is strictly greater than its neighbors.

Given a 0-indexed integer array nums, find a peak element, and return its index. If the array contains multiple peaks, return the index to any of the peaks.

September 13, 2023
Search a 2D Matrix - LeetCode : Swift

Search a 2D Matrix - LeetCode

You are given an m x n integer matrix matrix with the following two properties:

September 12, 2023
Length of Last Word - LeetCode : Swift

Length of Last Word - LeetCode

Given a string s consisting of words and spaces, return the length of the last word in the string. A word is a maximal substring consisting of non-space characters only.

September 11, 2023
Roman to Integer - LeetCode : Swift

Roman to Integer - LeetCode

Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.

September 10, 2023
Remove Duplicates from Sorted Array II - LeetCode : Swift

Remove Duplicates from Sorted Array || - LeetCode

Given an integer array nums sorted in non-decreasing order, remove some duplicates in-place such that each unique element appears at most twice. The relative order of the elements should be kept the same.

September 9, 2023
Best Time to Buy and Sell Stock - LeetCode : Swift

Best Time to Buy and Sell Stock - LeetCode

You are given an array prices where prices[i] is the price of a given stock on the ith day.

September 8, 2023
Rotate Array - LeetCode : Swift

Rotate Array - LeetCode

Given an integer array nums, rotate the array to the right by k steps, where k is non-negative.

September 6, 2023
Remove Duplicates from Sorted Array - LeetCode : Swift

Remove Duplicates from Sorted Array - LeetCode

Given an integer array nums sorted in non-decreasing order, remove the duplicates in-place such that each unique element appears only once. The relative order of the elements should be kept the same. Then return the number of unique elements in nums.

September 5, 2023
Remove Element - LeetCode : Swift

Remove Element - LeetCode

Given an integer array nums and an integer val, remove all occurrences of val in nums in-place. The order of the elements may be changed. Then return the number of elements in nums which are not equal to val.

September 4, 2023
Merge Sorted Array - LeetCode : Swift

Merge Sorted Array - LeetCode

You are given two integer arrays nums1 and nums2, sorted in non-decreasing order, and two integers m and n, representing the number of elements in nums1 and nums2 respectively.

September 3, 2023
Next Greater Element I - LeetCode : Swift

Next Greater Element I - LeetCode

The next greater element of some element x in an array is the first greater element that is to the right of x in the same array.

Prev 1 2 3