Tip 1: Stay attentive during graduation and grasp the subjects well.
Tip 2: Focus on mastering one programming language.
Tip 3: Solve LeetCode questions.
Tip 1: Make it a single page.
Tip 2: Mention relevant skills for the job you are applying for.
In the morning, HR contacted me by phone. After a brief introduction, she connected me with the technical team. They inquired about the details mentioned in my resume through basic questions. This round went well.
Difference between Relational and non- Relational database?
How to select last two rows from a table?
What are indexes used for?
Tip 1: Make your base strong.
Tip 2: Practice SQL.
In the morning, I received a meeting link and promptly joined it. The technical team greeted me warmly and began their questioning. Thanks to thorough preparation, the interview proceeded smoothly
Write a function in Python that takes a list of integers as input and returns the second-largest integer from the list. If there is no second-largest integer (e.g., if all integers in the list are the same), return None.Example:def second_largest(nums: List): # Your code hereprint(second_largest([3, 1, 4, 2, 5])) # Should return 4print(second_largest([1, 1, 1, 1, 1])) # Should return Noneprint(second_largest([5, 5, 3, 3, 1])) # Should return 3
This problem was fairly very simple
1. Define a function second_largest that takes a list of integers nums as input.
2. Initialize two variables, max_num and second_max, to store the maximum and second-maximum integers in the list, respectively. Set max_num to negative infinity and second_max to None initially.
3. Iterate through each element num in the list nums.
4. For each num, compare it with max_num:
If num is greater than max_num, update both max_num and second_max. Set second_max to the current value of max_num, and update max_num to num.
If num is less than max_num but greater than second_max, update only second_max.
5. After iterating through all elements in the list, return second_max.
6. If second_max is still None after the loop, it means there is no second-largest integer in the list, so return None.
You are given an array of integers nums, where each element represents the price of a stock on a given day. You are allowed to complete at most one transaction (i.e., buy one and sell one share of the stock), design an algorithm to find the maximum profit you can achieve.Example:def max_profit(nums): # Your code here# Test casesprint(max_profit([7, 1, 5, 3, 6, 4])) # Should return 5 (Buy on day 2 (price = 1) and sell on day 5 (price = 6), profit = 6-1 = 5)print(max_profit([7, 6, 4, 3, 1])) # Should return 0 (In this case, no transaction is done, i.e., max profit = 0)
This problem was of medium difficulty
1. Define a function max_profit that takes a list of integers nums representing the stock prices as input.
2. Initialize two variables, min_price and max_profit, to keep track of the minimum stock price seen so far and the maximum profit that can be achieved, respectively. Set min_price to the first element of the list and max_profit to 0 initially.
3. Iterate through each element price in the list starting from the second element:
Update min_price to be the minimum of the current price and min_price.
Update max_profit to be the maximum of the difference between the current price and min_price and the current max_profit.
4. After iterating through all elements in the list, return max_profit.
You are given a directed acyclic graph (DAG) represented as an adjacency list. Write a function to find the longest path in the graph from a given source vertex to a target vertex.Example:def longest_path(graph, source, target): # Your code here# Test casegraph = { 'A': [('B', 5), ('C', 3)], 'B': [('D', 7)], 'C': [('D', 2)], 'D': [('E', 4), ('F', 6)], 'E': [('F', 1)]}source = 'A'target = 'F'print(longest_path(graph, source, target)) # Output should be 15 (A -> C -> D -> F)
1. Initialize a dictionary dist to keep track of the longest distance from the source vertex to each vertex in the graph. Set the distance of the source vertex to 0 and all other vertices to negative infinity initially.
2. Implement a topological sorting algorithm to sort the vertices of the graph in topological order. This ensures that we process vertices in the correct order to compute their longest distances.
3. Iterate through the vertices in topological order:
a. For each vertex u, iterate through its outgoing edges (u, v) and update the distance of vertex v if the distance of u plus the weight of the edge (u, v) is greater than the current distance of v.
4. After processing all vertices, the longest distance from the source vertex to the target vertex is stored in dist[target]. Return this value.
This managerial round took place in the afternoon and consisted of a general discussion encompassing topics from resumes, projects, and general aspects. Overall, the round was straightforward.
Explain your project and how this could be used at scale?
Tip 1: Study your projects well.
1. Can you describe a situation where you had to handle a difficult team member? How did you approach the situation and what was the outcome?
2. How do you prioritize tasks and manage your time effectively, especially when faced with multiple deadlines?
3. Can you provide an example of a successful project you managed from start to finish? What were the key challenges you faced and how did you overcome them?
4. How do you handle conflict or disagreements within a team? Can you give an example of a time when you successfully resolved a conflict?
Tip 1: Stay positive and read such answers before hand.
Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
Which of these access modifiers must be used for the main() method?