Write down your own questions (mostly in javascript and Python3).
Stick to one or two questions a day! Continuously updated…
The serial number below is not the serial number of the subject. The serial number of the subject can be viewed by clicking the link to enter the warehouse (/ \ omega)
-
Given an array of integers and a target value, find two numbers that neutralize the target value in the array. answer
-
Given a 32 – bit signed integer, invert the number in the integer. answer
-
Checks whether an integer is a palindrome. Palindromes are integers that are read in positive order (left to right) and backward order (right to left). answer
-
Given a Roman numeral, convert it to an integer. Make sure the input is in the range of 1 to 3999. answer
-
Given a only include a ‘(‘,’) ‘, ‘{‘,’} ‘, ‘/’, ‘ ‘string, to determine whether a string effectively, left and right parentheses must match. answer
-
Write a function to find the longest public prefix in an array of strings. answer
-
Given a sorted array, you need to remove duplicate elements in place so that each element appears only once, returning the new length of the removed array. answer
-
Given an array nums and a value val, you remove all elements with a value equal to val in place, returning the new length of the array. answer
-
Given a Haystack string and a Needle string, find the first position in the Haystack string where the Needle string appears (starting from 0). If none exists, -1 is returned. answer
-
Given a sorted array and a target value, find the target value in the array and return its index. If the target value does not exist in the array, return the position where it will be inserted in order. answer
-
Given a positive integer n (1 ≤ n ≤ 30), print the NTH term of the integer sequence. answer
-
Given an integer array nums, find a contiguous subarray with the maximum sum (the subarray contains at least one element) and return the maximum sum. answer
-
Given a string containing only uppercase and lowercase letters and Spaces, return the length of its last word. If the last word does not exist, return 0. answer
-
Given a non-negative integer represented by a non-empty array of integers, add one to that number. The highest digit is stored at the beginning of an array, where each element stores only one digit. answer
-
Suppose you’re climbing stairs. It takes n steps to get to the top. You can climb one or two steps at a time. How many different ways can you climb to the top? answer
-
Given two binary strings, return their sum (in binary). The input is a non-empty string containing only the digits 1 and 0. answer
-
Implement the int SQRT (int x) function. answer
-
Given two ordered integer arrays nums1 and nums2, merge nums2 into nums1 so that num1 becomes an ordered array (note: change the original array method)
-
Given an array of non-empty integers, each element appears twice except for one element. Find the element that appears only once. answer
-
Given a non-negative integer numRows, generate the former numRows of the Yanghui triangle. answer
-
Given a nonnegative index k, where k ≤ 33, return the KTH row of the Yang Hui triangle. answer
-
Given an array, its ith element is the price of a given stock on the ith day. If you only allow one trade (buy and sell one stock), design an algorithm to calculate the maximum profit you can make. Note that you can’t sell a stock before you buy it. answer
-
Design a stack that supports push, pop, and top operations and can retrieve the smallest element in constant time. answer
-
Given an ordered array that has been sorted in ascending order, find two numbers that add up to the target number. answer
-
Given a positive integer, return its corresponding column name in the Excel table. answer
-
Given an array of size n, find the mode. Mode is the element that occurs more than ⌊ n/2 ⌋ in the array. answer
-
Given an integer n, return n! Result the number of zeros in the mantissa. answer
-
Write an algorithm to determine if a number is a “happiness number.” answer
-
Count the number of primes less than the non-negative integer n. answer
-
Given two strings s and t, determine whether they are isomorphic. answer
-
Given an integer array and an integer k, determine whether there are two different indexes I and j in the array such that nums [I] = nums [j] and the absolute value of the difference between I and j is at most K. answer
-
Given an integer, write a function to determine whether it is a power of two. answer
-
Write a program to determine whether a given number is ugly. Ugly numbers are positive integers that contain only prime factors 2, 3, and 5. answer
-
Given a field containing 0, 1, 2… , the sequence of n numbers in n, find 0.. The number in n that does not appear in the sequence. answer
-
You and your friend, two people, play Nim: there is a pile of rocks on the table, and you take turns removing one to three rocks at a time. Whoever removes the last stone is the winner. You’re the first. You’re smart people. Every step is the best solution. Write a function that determines whether you can win the game with a given number of stones. answer
-
Given an integer array nums, find the sum of the elements in the range from index I to j (I ≤ j), including I and j. answer
-
Given an integer, write a function to determine whether it is a power of 3. answer
-
Given an integer, write a function to determine whether it is a power of 4. answer
-
Write a function that reverses the input string. answer
-
Given two arrays, write a function to calculate their intersection. answer
-
The number of occurrences of each element in the output should be the same as the number of occurrences of the element in both arrays. answer
-
Given a positive integer num, write a function that returns True if num is a perfect square and False otherwise. Do not use any built-in library functions such as SQRT. answer
-
Computes the sum of two integers A and b without using the operators + and -. answer