Coding

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order. Example 1: Input: nums = [2,7,11,15], target...

Given an integer x, return true if x is palindrome integer.An integer is a palindrome when it reads the same backward as forward. For example, 121 is palindrome while 123 is not. Example 1:Input: x = 121 Output: true Example 2:Input: x = -121 Output: false Explanation: From left to right, it reads -121. From right to left, it becomes 121-....

Given a signed 32-bit integer x, return x with its digits reversed. If reversing x causes the value to go outside the signed 32-bit integer range [-231, 231 - 1], then return 0.Assume the environment does not allow you to store 64-bit integers (signed or unsigned). Example 1:Input: x = 123 Output: 321 Example 2:Input: x...

Given an array of integers nums, sort the array in ascending order. Example 1:Input: nums = [5,2,3,1] Output: [1,2,3,5] Example 2:Input: nums = [5,1,1,2,0,0] Output: [0,0,1,1,2,5]  Constraints:1 <= nums.length <= 5 * 104-5 * 104 <= nums[i] <= 5 * 104  https://www.jianshu.com/p/bbbab7fa77a2冒泡排序(Bubble Sort) pythonclass Solution:    def sortArray(self, nums: List[int]) -> List[int]:     ...

Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1: Input: 121 Output: true Example 2: Input: -121 Output: false Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome. Example 3: Input: 10 Output: false Explanation:...

1. Two SumGiven an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the same element twice.Example:Given nums = [2, 7, 11, 15], target = 9, Because nums[0] +...