This year’s Google I/O 2021 is going to be held virtually. To reveal the event’s date Google has come up with an intriguing Punch Card Puzzle 🧩 for the developers. I would suggest you try it on your own first and if you stuck somewhere you can refer to this article.
You have to find the person who said the following quote.
You can copy and paste the quote on Google to find the person.
“It matters little who first arrives at an idea, rather what is significant is how far that idea can go.”
- Sophie Germain.
Given an array of integers
nums and an integer
targetSum, return two numbers such that they add up to
Input: nums = [2,7,11,15], targetSum = 18
This is a naive approach in which we will be using two nested loops and checking if at any point they are equal to our
def twoNumberSum(nums, targetSum):
for i in range(len(nums)-1):
for j in range(i+1,len(nums)):
if targetSum == nums[i]+nums[j]:
For every element in the given array
nums we will check with other elements present whether the sum of both of the element equals to our
Coder ⚡ Developer ⚡Writer