Skip to main content

Posts

Showing posts from July, 2020

Big O Notation - Time and Space complexity

Big O - In simple words, this describes how long an algorithm takes to run and how much space it takes. It expresses how the runtime quickly grows with respect to the input. This is how we compare different algorithms's efficiency. Some quick notes -  - N could be the actual input or the size of the input - We always talk about the worst-case here - We drop constants and less significant terms since as input grow infinitely large constants and less significant terms do not make much difference Space complexity talks about memory or space. This measures, how memory grows as the input size increases.  Usually, when we talk about space complexity, we're talking about  additional space The link I referred - https://www.interviewcake.com/article/java/big-o-notation-time-and-space-complexity Interview tips - Always talk about time and space complexity at the end. This will earn you bonus points! FAANG companies expect this even if they don't ask explicitly.  Some usef...

Coding round interview questions tips

Tips from the google coding interview video https://www.youtube.com/watch?v=XKu_SEDAykw Always ask for clarifications - some tips below Think out loud Talk about all the solutions before you code out Test a few inputs after writing code by tracing it before saying I am done Talk while coding Talk about time and space complexity at the end to get bonus points Read out the problem loud in a way you understood - Do not code out the wrong solution Clarifying questions Clarify the input & output. E.x. This function accepts 2 arrays and returns an integer, Am I right? Sorting - array already sorted, reverse sorted or not sorted? Can there be -ve elements? Can there be only integers or other types? String - other than English? Can it contain special chars, Unicode, upper case and lower case letters? https://medium.com/@mgtei/how-why-to-ask-clarifying-questions-at-a-whiteboard-interview-for-junior-devs-97571fdc629e Key point to succeed in this round is just don't give up on the problem...

Test data generation or Unit testing interview questions

Some useful info about how to do unit testing- Unit testing is done by developers in an early development stage. Uncovering bugs early saves time and cost. An individual unit of the software is tested by isolating it. Tips and examples-  1. The question could be asked as writing unit tests or writing test data for a function 2. Remember to cover positive, input check, boundary, edge and corner cases 3. Unit tests format will look like this -  Test 1: i/p: None, None o/p: None Test 2: i/p: o/p: 4. Python unit test example - Import pytest Class TestAnagram(unittest.TestCase) Def test_input(self): Assert anagram(“cat”, “dog”) == False Def test_valid(self) Assert anagram(“cat”, “tac”) == True Def test_error(self) With pytest.raises(Exception) anagram(None, None) 5. Test data format None, None None, “cat” “Cat”, None Interview questions - Q: find_second_largest_number(array) {} - I did not write the code, function like this was written on the board. Write te...

Test case writing round interview questions

Test scenarios writing or test case writing round questions are listed here. Answers will be in other individual posts.  1. Write test scenarios for a vending machine. Company: Zenefits 2. Write test scenarios for a login page. Company: Zenefits 3. Write test scenarios for the amazon live code portal(livecode.amazon.jobs) which you are using for this interview. Company: Amazon 4. Write test cases for a file upload page. There would be a simple web application that has a box input to accept URL and there would be a button to upload. You can access the server to check the file has been uploaded or not. Backend there would be a database to store the file. Company: Amazon