programming,c++,python,MachineLearning,Math,Django,Competitive

leetcode

Statement https://leetcode.com/problems/keyboard-row/ Given a List of words, return the words that can be typed using letters of alphabet on only one row's of American keyboard like the image below. 要するにキーボードの列 "QWERTYUIP", "ASD…

Statement Example Constrains Answer 1 Statement Alice and Bob take turns playing a game, with Alice starting first. Initially, there is a number N on the chalkboard. On each player's turn, that player makes a move consisting of: Choosing a…

Statement Example Constrains Answer 1 Answer 2 Answer 3 Statement (Good, Bad) = (176, 902) Given an array A of integers, for each integer A[i] we may choose any x with -K <= x <= K, and add x to A[i]. After this process, we have some array…

Statement Example Constrains Answer 1 Statement Given a string S and a character C, return an array of integers representing the shortest distance from the character C in the string. 文字列 S と 文字 Cが与えられる 文字列 Sの中にある文字Cと…

Statement Example Constrains Answer 1 Answer 2 Statement The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, starting from 0 and 1. That i…

Statement Example Constrains Answer 1 Statement Given an array A of strings made only from lowercase letters, return a list of all characters that show up in all strings within the list (including duplicates). For example, if a character o…

Statement Example Constrains Answer 1 Statement Given an array of distinct integers arr, find all pairs of elements with the minimum absolute difference of any two elements. Return a list of pairs in ascending order(with respect to pairs),…

Statement Example Constrains Answer 1 Answer 2 Statement Write a function that reverses a string. The input string is given as an array of characters char[]. Do not allocate extra space for another array, you must do this by modifying the …

Statement Example Constrains Answer 1 Statement You are given an array of strings words and a string chars. A string is good if it can be formed by characters from chars (each character can only be used once). Return the sum of lengths of …

Statement Example Constrains Answer 1 Statement Given two arrays arr1 and arr2, the elements of arr2 are distinct, and all elements in arr2 are also in arr1. Sort the elements of arr1 such that the relative ordering of items in arr1 are th…

Statement Example Constrains Answer 1 Statement Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order. 文字列が与えられる 空白で区切って、それぞ…

Statement Example Constrains Answer 1 Statement A website domain like "discuss.leetcode.com" consists of various subdomains. At the top level, we have "com", at the next level, we have "leetcode.com", and at the lowest level, "discuss.leet…

Statement Example Constrains Answer 1 Double Ended Queue Answer 2 Statement Given an array A of non-negative integers, half of the integers in A are odd, and half of the integers are even. Sort the array so that whenever A[i] is odd, i is …

Statement Example Constrains Answer 1 Statement Students are asked to stand in non-decreasing order of heights for an annual photo. Return the minimum number of students that must move in order for all students to be standing in non-decrea…

Statement Example Constrains Answer 1 Statement Given a m * n matrix mat of ones (representing soldiers) and zeros (representing civilians), return the indexes of the k weakest rows in the matrix ordered from the weakest to the strongest. …

Statement Example Constrains Answer 1 Answer 2 Answer 3 Statement Given an integer array arr. You have to sort the integers in the array in ascending order by the number of 1's in their binary representation and in case of two or more inte…

Statement Example Constrains Answer 1 Statement Given the root node of a binary search tree (BST) and a value. You need to find the node in the BST that the node's value equals the given value. Return the subtree rooted with that node. If …

Statement Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as large as possible. 2n 個の整数値の配列が与…

Statement Given a string S that only contains "I" (increase) or "D" (decrease), let N = S.length. Return any permutation A of [0, 1, ..., N] such that for all i = 0, ..., N-1: - If S[i] == "I", then A[i] < A[i+1] - If S[i] == "D", then A[i…