Print the squares of all positive integers not greater than n in increasing order.
One positive integer n (n ≤ 10**9).
Print the list of all positive integers not greater than n in increasing order.
🕑 Time limit 1 second
💾 Memory limit 128 MiB
10
1 4 9
20
1 4 9 16
Four numbers a, b, c, d are given. Find the maximum among them.
Four integers, not greater than 1000 by absolute value.
Print the maximum among four numbers.
🕑 Time limit 1 second
💾 Memory limit 128 MiB
1 2 3 4
4
Given a non-empty array of integers nums, every element appears twice except for one. Find that single one.
You must implement a solution with a linear runtime complexity and use only constant extra space.
🕑 Time limit 1 second
💾 Memory limit 128 MiB
[2,2,1]
1
[4,1,2,1,2]
4
Given an array nums of size n, return the majority element.
The majority element is the element that appears more than ⌊n / 2⌋ times. You may assume that the majority element always exists in the array.
🕑 Time limit 1 second
💾 Memory limit 128 MiB
[3,2,3]
3
[2,2,1,1,1,2,2]
2
Given a string s, find the first non-repeating character in it and return its index. If it does not exist, return -1.
🕑 Time limit 1 second
💾 Memory limit 128 MiB
"leetcode"
0
"loveleetcode"
2
"aabb"
-1