AMAZON CODING INTERVIEW QUESTION - ROTTING ORANGES
SOCIAL
----------------------------------------------------------------------------------------------------------------
Instagram: https://instagram.com/kevinnaughtonjr/
Twitter: https://twitter.com/KevinNaughtonJr
Patreon: https://www.patreon.com/KevinNaughtonJr
GitHub: https://github.com/kdn251
This is one of Amazon's most commonly asked interview questions according to LeetCode (2019)! rotting oranges coding solution. If you give me 10 minutes you'll thank me if this appears during your Amazon interview! Coding Interviews rotting oranges (LeetCode) question and explanation.
DISCORD CHANNEL
----------------------------------------------------------------------------------------------------------------
To join the Discord channel use the following link and join the "Member" tier: https://www.patreon.com/KevinNaughtonJr In this Discord channel, you will be able to...
1. Ask me questions directly (as well as other members)
2. Ask about and discuss previous interview experiences
3. Find mock interview partners
4. Share helpful videos for interview preparation, and more!
This question is commonly asked by the following companies: Amazon and Flipkart
Link to problem: https://leetcode.com/problems/rotting-oranges/
Intuition behind solution: save the initial state of the board by creating two hash sets to store both fresh oranges and rotten oranges. Iterate through the board populating both hash sets. Initialize your "minutes" to 0 and initialize a 2d integer array to represent the 4 cardinal directions (up, down, left, and right). While you have fresh oranges attempt to "infect" additional oranges by checking all rotten oranges you have and see if they have neighboring fresh oranges. Any time that they do, add that newly rotten orange to your "infected" hash set. Once you've run through all your rotten oranges you have available, if no new oranges became rotten (i.e. the size of infected is 0) return -1. Otherwise, continue your BFS by setting rotten = infected and incrementing the number of minutes elapsed by 1. Once your loop terminates return minutes.
MUSIC
----------------------------------------------------------------------------------------------------------------
xo bored llif3 by young frontwood
https://soundcloud.com/youngfrontwood/xo-bored-lif3
#techinterviews #leetcode #amazoninterview
Видео AMAZON CODING INTERVIEW QUESTION - ROTTING ORANGES канала Kevin Naughton Jr.
----------------------------------------------------------------------------------------------------------------
Instagram: https://instagram.com/kevinnaughtonjr/
Twitter: https://twitter.com/KevinNaughtonJr
Patreon: https://www.patreon.com/KevinNaughtonJr
GitHub: https://github.com/kdn251
This is one of Amazon's most commonly asked interview questions according to LeetCode (2019)! rotting oranges coding solution. If you give me 10 minutes you'll thank me if this appears during your Amazon interview! Coding Interviews rotting oranges (LeetCode) question and explanation.
DISCORD CHANNEL
----------------------------------------------------------------------------------------------------------------
To join the Discord channel use the following link and join the "Member" tier: https://www.patreon.com/KevinNaughtonJr In this Discord channel, you will be able to...
1. Ask me questions directly (as well as other members)
2. Ask about and discuss previous interview experiences
3. Find mock interview partners
4. Share helpful videos for interview preparation, and more!
This question is commonly asked by the following companies: Amazon and Flipkart
Link to problem: https://leetcode.com/problems/rotting-oranges/
Intuition behind solution: save the initial state of the board by creating two hash sets to store both fresh oranges and rotten oranges. Iterate through the board populating both hash sets. Initialize your "minutes" to 0 and initialize a 2d integer array to represent the 4 cardinal directions (up, down, left, and right). While you have fresh oranges attempt to "infect" additional oranges by checking all rotten oranges you have and see if they have neighboring fresh oranges. Any time that they do, add that newly rotten orange to your "infected" hash set. Once you've run through all your rotten oranges you have available, if no new oranges became rotten (i.e. the size of infected is 0) return -1. Otherwise, continue your BFS by setting rotten = infected and incrementing the number of minutes elapsed by 1. Once your loop terminates return minutes.
MUSIC
----------------------------------------------------------------------------------------------------------------
xo bored llif3 by young frontwood
https://soundcloud.com/youngfrontwood/xo-bored-lif3
#techinterviews #leetcode #amazoninterview
Видео AMAZON CODING INTERVIEW QUESTION - ROTTING ORANGES канала Kevin Naughton Jr.
Показать
Комментарии отсутствуют
Информация о видео
Другие видео канала
![Facebook Coding Interview Question - How Many Ways to Decode This Message?](https://i.ytimg.com/vi/qli-JCrSwuk/default.jpg)
![GOOGLE PHONE INTERVIEW QUESTION - LARGEST VALUES FROM LABELS](https://i.ytimg.com/vi/84xibeO_lqk/default.jpg)
![AMAZON CODING INTERVIEW QUESTION - SPIRAL MATRIX](https://i.ytimg.com/vi/BdQ2AkaTgOA/default.jpg)
![AMAZON CODING INTERVIEW QUESTION - REORGANIZE STRING](https://i.ytimg.com/vi/zaM_GLLvysw/default.jpg)
![Rotten oranges problem | Leetcode #994](https://i.ytimg.com/vi/CxrnOTUlNJE/default.jpg)
![Facebook Coding Interview Question - findLongestSubarrayBySum](https://i.ytimg.com/vi/XFPHg5KjHoo/default.jpg)
![Rotting Oranges | LeetCode 994 | C++, Java, Python](https://i.ytimg.com/vi/XiUmnWXh-9E/default.jpg)
![](https://i.ytimg.com/vi/DP-40Eh2PM8/default.jpg)
![SOLVING GOOGLE'S 2020 MOST ASKED INTERVIEW QUESTION](https://i.ytimg.com/vi/9Q73ScVu2GI/default.jpg)
![Top 25 Microservice Interview Questions Answered - Java Brains](https://i.ytimg.com/vi/o36vWQCRrp0/default.jpg)
![SOLVING FACEBOOK'S 2020 MOST ASKED INTERVIEW QUESTION](https://i.ytimg.com/vi/jZBnFxIe4Y8/default.jpg)
![AMAZON CODING INTERVIEW QUESTION - LONGEST COMMON PREFIX (LeetCode)](https://i.ytimg.com/vi/1YQmI7F9dJ0/default.jpg)
![GOOGLE - DELETE NODES AND RETURN FOREST (LeetCode)](https://i.ytimg.com/vi/aaSFzFfOQ0o/default.jpg)
![SOLVING MICROSOFT'S 2020 MOST ASKED INTERVIEW QUESTION](https://i.ytimg.com/vi/pD3cHFNyW2I/default.jpg)
![GOOGLE CODING INTERVIEW QUESTION - LETTER COMBINATIONS OF A PHONE NUMBER (LeetCode)](https://i.ytimg.com/vi/21OuwqIC56E/default.jpg)
![Practice idea: Top 5 Toughest Interview Questions](https://i.ytimg.com/vi/-HfgkKlmcmA/default.jpg)
![AMAZON CODING INTERVIEW QUESTION - COIN CHANGE (LeetCode)](https://i.ytimg.com/vi/1R0_7HqNaW0/default.jpg)
![Hard SQL Interview Question From FACEBOOK | Data Science Coding Interviews (Popularity Percentage)](https://i.ytimg.com/vi/_gy1o9UH2dQ/default.jpg)
![FACEBOOK - WALLS AND GATES (LeetCode)](https://i.ytimg.com/vi/Pj9378ZsCh4/default.jpg)
![GOOGLE CODING INTERVIEW QUESTION - SHORTEST WAY TO FORM STRING](https://i.ytimg.com/vi/evesA3gr9BE/default.jpg)