Posts

Showing posts with the label aws interview question

Amazon Interview question from leetcode coding problem 1

Hi, This is  Shubham Mishra  from India,  this is the part of  Ruby on Rails  exploration journey.  In this post we will discuss about the leetcode problem and its both worst and best case solution asked in Amazon interview process and I am sure you will get excited to make your hands dirty with those code, so why to wait let's get started... Problem Statement: Return the indices of the two numbers such that they add up to target given an array of integers nums and an integer target. You may presume that each input would have exactly one solution, and you may not use the same element twice. The input array nums can be assumed to not be sorted, but you are free to return the solution in any order. Example: Input: nums = [2,7,11,15], target = 9 Output: [0,1] Explanation: nums[0] + nums[1] = 2 + 7 = 9, so [0, 1] is the correct answer. Here is the function signature in Python to help you get started: The problem is to find two indices in an array o...