Leetcode-Top -150-Interview-Question -Day -2: Array && String
Question 1:169. Majority Element
Problem Statement:
In this question we are given an array nums of size n. We need to return the majority Element.
Majority Element : The majority element is the element that appears more than N/2 times.
CODE:
Complexity :
Time complexity: O(n);
Space Complexity: O(1);
QUESTION 2 : 383. Ransom Note
Problem Statement:
In this question we are given two strings (ransomNote) and (magazine) . We just need to return boolean if (ransomNote ) string is contructed by using letters of (magazine).
CODE :
Complexity :
Time complexity: O(n);
Space Complexity: O(26) ~O(1);
HOPE YOU LIKE MY APPROACHES!!!
THANKYOU!!!