RoutePairs
C++ languageโ (Amazon)
C++ languageโ (Amazon)
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Approach: we need to calculate the forward route list + return route list 2nd point and we will find the maximum of the list after that I will compare the forward route list and +return list if they are equal then I will push in 1 D vector then I will push 2nd vector in answer and finally we will return 2D vector answer
Complexity Analysis:
time complexity O(N*M)
N is the size of the forward route list and return route list
space complexity O(N*M)
and here N and M is the size of our 2D vector answer
Complexity Analysis:
time complexity O(N*M)
N is the size of the forward route list and return route list
space complexity O(N*M)
and here N and M is the size of our 2D vector answer
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
'''
Find K Closest Points to the Origin
Approach: The idea is to calculate the Euclidean distance from the origin for every given point and sort the array according to the Euclidean distance found. Print the first k closest points from the list.
Algorithm :
Consider two points with coordinates as (x1, y1) and (x2, y2) respectively. The Euclidean distance between these two points will be:
โ{(x2-x1)2 + (y2-y1)2}
Sort the points by distance using the Euclidean distance formula.
Select first K points form the list
Print the points obtained in any order.
Complexity Analysis:
Time Complexity: O(n log n).
Time complexity to find the distance from the origin for every point is O(n) and to sort the array is O(n log n)
Space Complexity: O(n).
As we are making an array to store distance from the origin for each point.
'''
def deliveryPlan(allLocation, NumDeliveries):
allLocation.sort(key = lambda NumDeliveries: NumDeliveries[0]2 + NumDeliveries[1]2)
return allLocation[:NumDeliveries]
Amazon โ
Find K Closest Points to the Origin
Approach: The idea is to calculate the Euclidean distance from the origin for every given point and sort the array according to the Euclidean distance found. Print the first k closest points from the list.
Algorithm :
Consider two points with coordinates as (x1, y1) and (x2, y2) respectively. The Euclidean distance between these two points will be:
โ{(x2-x1)2 + (y2-y1)2}
Sort the points by distance using the Euclidean distance formula.
Select first K points form the list
Print the points obtained in any order.
Complexity Analysis:
Time Complexity: O(n log n).
Time complexity to find the distance from the origin for every point is O(n) and to sort the array is O(n log n)
Space Complexity: O(n).
As we are making an array to store distance from the origin for each point.
'''
def deliveryPlan(allLocation, NumDeliveries):
allLocation.sort(key = lambda NumDeliveries: NumDeliveries[0]2 + NumDeliveries[1]2)
return allLocation[:NumDeliveries]
Amazon โ
Revature (Python 3)โ
Revature (Python 3)โ
First line chnage
n=int(input())
Revature (Python 3)โ
n=int(input())
Revature (Python 3)โ
OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ
Hexaview is hiring for below roles (There is a bond of 2 years) โ
Only first 100 resumes will entertain. โ
Please see below the details : On-Job Training Duration - 6 months Stipend - 20,000 INR for Application Engineer and Member of Technical Staff โฆ
The one who all are shortlisted got the mail for exam.
We again open the same form at night 8PM.
๐๐Note: If you don't have any coding background, this will not able to help you because they are selecting based on coding profile.
Be ready at 8PMโค๏ธโ
We again open the same form at night 8PM.
๐๐Note: If you don't have any coding background, this will not able to help you because they are selecting based on coding profile.
Be ready at 8PMโค๏ธโ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
The one who all are shortlisted got the mail for exam. We again open the same form at night 8PM. ๐๐Note: If you don't have any coding background, this will not able to help you because they are selecting based on coding profile. Be ready at 8PMโค๏ธโ
Here is the link: https://forms.gle/qdHMXLX7PvFDewbY8
Note: Make sure you have good coding background, otherwise recruiter will not select๐ข
Note: Make sure you have good coding background, otherwise recruiter will not select๐ข
๐ฑ1