Objects 💻

Task 1 🎯

Squares of numbers

Print the squares of all positive integers not greater than n in increasing order.

Input

One positive integer n (n ≤ 10**9).

Output

Print the list of all positive integers not greater than n in increasing order.

🕑 Time limit 1 second

💾 Memory limit 128 MiB

Input example 1

10

Output example 1

1 4 9 

Input example 2

20

Output example 2

1 4 9 16 

Task 2 🎯

Maximum among four numbers

Four numbers a, b, c, d are given. Find the maximum among them.

Input

Four integers, not greater than 1000 by absolute value.

Output

Print the maximum among four numbers.

🕑 Time limit 1 second

💾 Memory limit 128 MiB

Input example 1

1 2 3 4

Output example 1

4

Task 3 🎯

Single Number

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

Input example 1

[2,2,1]

Output example 1

1

Input example 2

[4,1,2,1,2]

Output example 2

4

Task 4 🎯

Majority Element

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

Input example 1

[3,2,3]

Output example 1

3

Input example 2

[2,2,1,1,1,2,2]

Output example 2

2

Task 5 🎯

First Unique Character in a String

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

Input example 1

"leetcode"

Output example 1

0

Input example 2

"loveleetcode"

Output example 2

2

Input example 3

"aabb"

Output example 3

-1