570 likes | 671 Views
CRACKING THE CODING INTERVIEW Nitish Upreti. Nitish Upreti @nitish http:// niti.sh /. Feedback Please ! ( I am a Data Junkie… ) www.meet.ps. Why this Talk? Why should you care ?. For the love of Computer Science …. Building Amazing Products. Working with the best of People….
E N D
Working for the Top Technology Companies.(Computer Science-Engineering majors are most pampered and well paid…)
Some of us are scared !How does the interview work?What do they judge me on?Do’s / Don’ts
Are these interviews fair?Can you judge someone in few hours or a day?
Think of Interviews as acing SATs / GREs …(Whether they are any good is debatable!)
GAME PLAN : 1. Study all my subjects well.2. Finish all Assignments/Projects.3. Get an awesome GPA.
Would you practice for a Sprint by running marathons each day?
Preparations Matter!“Sweat now so you don't bleed later.” Take Away….
How to get interviews at the first place? • Career fairs. • Referrals from friends and seniors. (Almost guarantees an interview) • Be active on LinkedIn. • Visit Hackathons. • Start competing on HackerRank / TopCoder. • Email cto_first_name / ceo_first_name @startup
Quick Preliminaries • Perfect your resume (No spelling mistakes / grammar errors) ACM provides help! • Prepare Behavioral Questions
How does the Interview Process work ?( At least for the Popular Ones …. )
Interview Process • Starts with an Email Conversation. • Scheduling day/time for Phone or Campus screening • Internships : Usually 2 telephonic rounds. • Full time : 5-7 interviews • PSU Microsoft experience is an exception when it comes to interviews. (Why?) • You are notified in a couple of weeks. • Details are in the Book!
White Board Coding….(Without the cozy compiler : Marathon and Sprint metaphor again!)
Almost Comprehensive List … • Elementary DS : • Arrays, Stacks & Queues • Linked Lists • Trees ( Binary Trees, Binary Search Trees) • Hash Tables • Asymptotic Analysis • Sorting with their Runtimes. • Recursion ! • String Problems • Good to know : TRIE and Priority Queue ( BinaryHeap)
Advanced • Divide and Conquer Algorithms. • Greedy Algorithms • Dynamic Programming • Graph Algorithms • Some Design Problems
Key things to keep in mind • All questions are language independent. • Start Talking ( Interviewers nudge you towards the right direction ) • Think before you start / Don’t rush. • Propose a variety of solutions idea before settling on coding a particular idea. • Sound Enthusiastic ! • Ask questions in the end : How do you work? What do you work on?
Make Or Break it ! • Think about Corner cases. • Test your code once your done. • Be Space / Time Efficient. ( Distinguishes a Good Vs Bad Interview)
Given a set of integers, is there a subset of size k whose sum is zero?Array = { 3, 9, 1 , 6 , 0, 2 }Sum = 8
Brute Force Anyone ? Find all the possible sums and if the given sum is one of them, we have a solution! Brute Force could be a good start. Don’t code it yet !
Runtime Analysis ? O ( N2 )
Can we do better?At Google’s scale there will be Billion Numbers !
Sorting + Binary Search ? O (N log N) + O (log N)
How about a Hash Table Solution?First Passes :Create a Map (HashMap)Array = { 3, 9, 1 , 6 , 0, 2 }Hash = { (3,T) (9,T) (1,T) (6,T) (0,T)(2,T) }Scan through the keys & look for remainder.
Corner Case : Duplicate Elements ! Array = { 3, 9, 1 , 6 , 0, 4 }Hash = { (3,T) (9,T) (1,T) (6,T) (0,T)(4,T) } Solution : Store Count !
Complexity ? Time : O ( N ) Space : O ( N )