Find the K closest points to the origin.
Given an array of points where points[i] = [xi, yi] represents a point on the X-Y plane and an integer k, return the k closest points to the origin (0, 0).
Input: points = [[3,3],[5,-1],[-2,4]], k = 2
Output: [[3,3], [-2,4]]
Explanation: The squared distances are 18, 26, and 20 respectively. Th…
Count Anagrammatic Substrings
Count the number of anagrammatic substrings from one string present in another.
Input: s = "abab", p = "ab"
Output: [0, 1, 2]
Explanation: The substrings "ab", "ba", and "ab" starting at indices 0, 1, and 2 respectively are all anagrams of the string "ab".
Add Two Numbers Represented as Strings
Add two non-negative integers represented as strings.
Input: num1 = "456", num2 = "77"
Output: "533"
Explanation: Performs character-by-character addition from right to left, carrying the 1 from 6+7=13 to the next decimal place.
Determine if a Sudoku board is valid.
Determine if a 9 x 9 Sudoku board is valid. Only the filled cells need to be validated according to standard Sudoku rules: each row, column, and 3x3 sub-box must contain the digits 1-9 without repetition.
Input: board = 9x9 grid where the first row contains 7 twice
Output: FALSE
Explanation: A val…