Description
Question 1: You are given an integer array nums. The unique elements of an array are the elements that appear exactly once in the array. Return the sum of all the unique elements of nums. Example 1: |
Input: nums = [1,2,3,2] |
Example 2: |
Input: nums = [1,1,1,1,1] |
Example 3: |
Input: nums = [1,2,3,4,5] |
Question 2: |
Given an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order. Example 1: |
Input: nums = [-4,-1,0,3,10] Output: [0,1,9,16,100] |
Explanation: After squaring, the array becomes [16,1,0,9,100]. After sorting, it becomes [0,1,9,16,100]. |
Example 2: |
Input: nums = [-7,-3,2,3,11] Output: [4,9,9,49,121] |
Question 3:
Find first non repeated integer in an array.
Example: int[] arr = {2,3,4,2,2,3,5,7} Output : 4
Question 4:
Given two stings and , return true if can be constructed from magazine and false otherwise.
Each letter in magazine can only be used once in ransomNote. Example 1:
ransomNote
magazine
Input: ransomNote = “a”, magazine = “b” Output: false
Example 2:
ransomNote
Input: ransomNote = “aa”, magazine = “ab” Output: false
Example 3:
Input: ransomNote = “aa”, magazine = “aab” Output: true
Question 5:
Letter followed by Digit: Given a string str write a function which will check if the string no letter followed by another letter, and no digit followed by another digit.
For example: 1A3d4s5t Result : True
Input: A2bb2d4 Result : False