python3 / leetcode / explore - Arrays 101
python3 / leetcode / explore - Arrays 101
python3 / leetcode / explore - Arrays 101
python3 Review : 20240703 📎 Problem Given an array arr of integers, check if there exist two indices i and j such that : i != j 0 <= i, j < arr.length arr[i] == 2 * arr[j] Example 1: Example 2: ...
python3 Review : 20240704 📎 Problem Given an array of integers arr, return true if and only if it is a valid mountain array. Recall that arr is a mountain array if and only if: arr.length >= 3 T...
python3
python3 Problem Given an integer array nums, move all 0's to the end of it while maintaining the relative order of the non-zero elements. Note that
python3 Problem Given an integer array nums, move all the even integers at the beginning of the array followed by all the odd integers. Return any array that satisfies this condition. Example 1: ...
python3 Problem A school is trying to take an annual photo of all the students. The students are asked to stand in a single file line in non-decreas
python3 Problem Given an integer array nums, return the third distinct maximum number in this array. If the third maximum does not exist, return the maximum number. Example 1: Example 2: Example...
python3 Problem Given an array nums of n integers where nums[i] is in the range [1, n], return an array of all the integers in the range [1, n] that do not appear in nums. Example 1: Example 2: ...
python3 Problem Given an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order. Example 1: Example 2: Constraints: 1 <= n...
python3 Problem Given an array of integers nums, calculate the pivot index of this array. The pivot index is the index where the sum of all the numbers strictly to the left of the index is equal t...
python3 Problem You are given an integer array nums where the largest integer is unique. Determine whether the largest element in the array is at least twice as much as every other number in the ar...
python3 Problem You are given a large integer represented as an integer array digits, where each digits[i] is the ith digit of the integer. The digits are ordered from most significant to least sign...
python3 Problems Given an m x n matrix mat, return an array of all the elements of the array in a diagonal order. Example 1: Example 2: Constraints: m == mat.length n == mat[i].length 1 <= m, n ...
python3 Problem Given an m x n matrix, return all elements of the matrix in spiral order. Example 1: Example 2: Constraints: m == matrix.length n == matrix[i].length 1 <= m, n <= 10 -100 <= matr...
python3 📎 Problem Given an integer numRows, return the first numRows of Pascal's triangle. In Pascal's triangle, each number is the sum of the two numbers directly above it as shown: Example 1: ...
python3 Problem Given two binary strings a and b, return their sum as a binary string. Example 1: Example 2: Constraints: 1 <= a.length, b.length <= 104 a and b consist only of '0' or '1' charac...
python3 Problem Given two strings needle and haystack, return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. Example 1: Example 2: Constraints...
python3 Problem Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "". Example 1: Example 2: Constraint...
python3 📎 Probelm Write a function that reverses a string. The input string is given as an array of characters s. You must do this by modifying the input array in-place with O(1) extra memory. Ex...
python3 Probelm Given an integer array nums of 2n integers, group these integers into n pairs (a1, b1), (a2, b2), ..., (an, bn) such that the sum of min(ai, bi) for all i is maximized. Return the ma...
python3 📎 Probelm Given a 1-indexed array of integers numbers that is already sorted in non-decreasing order, find two numbers such that they add up to a specific target number. Let these two numb...
python3 📎 Problem 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 s...
python3 Problem Given an integer array nums, rotate the array to the right by k steps, where k is non-negative. Example 1: Example 2: Constraints: 1 <= nums.length <= 105 -231 <= nums[i] <= 231 -...
python3 📎 Problem Given an integer rowIndex, return the rowIndexth (0-indexed) row of the Pascal's triangle. In Pascal's triangle, each number is the sum of the two numbers directly above it as s...
python3 Problem Given an input string s, reverse the order of the words. A word is defined as a sequence of non-space characters. The words in s will be separated by at least one space. Return a ...
python3 📎 Problem Given a string s, reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order. Example 1: Example 2: Constraints: 1 ...
python3 📎 Problem Design your implementation of the linked list. You can choose to use a singly or doubly linked list. A node in a singly linked list should have two attributes: val and next. val i...
python3 Probelm Given head, the head of a linked list, determine if the linked list has a cycle in it. There is a cycle in a linked list if there is some node in the list that can be reached again...
python3 Problem Given the head of a linked list, return the node where the cycle begins. If there is no cycle, return null. There is a cycle in a linked list if there is some node in the list tha...
python3 Problem Given the heads of two singly linked-lists headA and headB, return the node at which the two lists intersect. If the two linked lists have no intersection at all, return null. For ...
python3Given the head of a linked list, remove the nth node from the end of the list and return its head.The number of nodes in the list is sz.1 <=
python3 Problem Given the head of a singly linked list, reverse the list, and return the reversed list. Example 1: Example 2: Example 3: Constraints: The number of nodes in the list is the rang...
python3 Problem Given the head of a linked list and an integer val, remove all the nodes of the linked list that has Node.val == val, and return the new head. Example 1: Example 2: Example 3: C...
python3 Problem Given the head of a singly linked list, group all the nodes with odd indices together followed by the nodes with even indices, and return the reordered list. The first node is cons...
python3 > Palindrome : 회문(거꾸로 읽어도 제대로 읽는 것과 같은 문장이나 낱말, 숫자, 문자열) 📎 Problem Given the head of a singly linked list, return true if it is a palindrome or false otherwise. Example 1: Example 2:
python3 📎 Problem You are given the heads of two sorted linked lists list1 and list2. Merge the two lists into one sorted list. The list should be made by splicing together the nodes of the first...
python3 Problem You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the tw...
python3 Problem You are given a doubly linked list, which contains nodes that have a next pointer, a previous pointer, and an additional child pointer. This child pointer may or may not point to a ...
python3 Problem A linked list of length n is given such that each node contains an additional random pointer, which could point to any node in the list, or null. Construct a deep copy of the list....
python3 📎 Problem Given the head of a linked list, rotate the list to the right by k places. Example 1: Example 2: Constraints: The number of nodes in the list is in the range [0, 500]. -100 <=...
python3 Problem Design your implementation of the circular queue. The circular queue is a linear data structure in which the operations are performed based on FIFO (First In First Out) principle, an...
python3 Problem Given an m x n 2D binary grid grid which represents a map of '1's (land) and '0's (water), return the number of islands. An island
python3 / leetcode / queue / bfs
python3 / leetcode / bfs / medium
python / leetcode / stack
python3 Problem Given an array of integers temperatures represents the daily temperatures, return an array answer such that answer[i] is the number of days you have to wait after the ith day to get...
python3 / leetcode / Queue&Stack
python3 / leetcode / Queue&Stack