Coding interview preparation
5.81K subscribers
375 photos
55 files
163 links
Download Telegram
Collections in java
How Long Should I Prepare for a Coding Interview?
Coding interview preparation time largely depends on the interviewee's level of experience. If you're an entry-level programmer, it's a good idea to spend at least twelve weeks preparing. If you have more experience, 4-8 weeks is suggested for interview prep.

Study the company's programming language and tools of choice. Practice a couple of coding challenges each day — don't let your practice be a cram session right before your coding interview. Finally, as you practice, make sure to time yourself to see how you are progressing.
Java HashMap vs TreeMap vs LinkedHashMap
How much time did you spend preparing for Google's interviews?
I spent six weeks preparing. Google was the only place I wanted to work. I had never used any real computer science constructs in my 30 years of work experience.

I got a whiteboard and markers and spent every day working on problems from Cracking the Code Interview. I solved the problems using C++ templates, to force myself to focus on the algorithms and notice what assumptions I was making about the underlying data types.

I had two weeks to prepare for the phone interview. After that I asked for a month to prepare for the on-site interviews.

Understand time/space complexity analysis. Know the time complexity of the basic data structures, especially hash tables. Learn to manage the space on the whiteboard. Think about where the computer will be repeating the same work twice, since that is probably where you can optimize.

The interviews are really not very hard. Don't panic.

p.s. I was hired.

Answer by
Bruce R. Miller
Google employee
Why do programmers like using Java?
Java, in my opinion, is the most royal language that doesn’t suffer an inferiority complex, unlike most other languages.

Other languages feel they need to bend over backward and satisfy the needs of the lazy developers who want to write as short and ambiguous reserved language words and variable/method/class names as possible.

Other languages require a huge amount of mental mapping that has to happen in the developer’s head in order for the developer to read and “compile” the code in their head, because of the shortcuts they take.

Other languages allow the developers to shoot themselves in the foot, and as most developers are really bad at what they do, the amount of shot feet is unbearable.

Code is written once and read 10–1000 times. Java is verbose and prose-like and lets you focus on logical thinking, rather than mind-mapping.

Java is official, ceremonial, royal and with high self-esteem - it gets the job done and it gets the job done right. You adhere to Java’s strict rules and so many amazingly good practices, and Java won’t let you down.

Java doesn’t use heaps of illogical syntax sugars that you have to memorize by heart, which otherwise don’t make any sense.

Java is versatile in the regards to that it can run everywhere.

Java is the perfect object-oriented language, it predisposes the user to craft code using the design patterns, the SOLID principles, the clean code and clean architecture, which makes it great for serious business, it makes it great for education and many of the best books on software engineering are written in Java because of that.

Java has a great name, too.

Kaloyan Roussev
Android Developer
Best suited IDE's for programming languages:

1. JavaScript => VSCode
2. Python => PyCharm
3. C# => Visual Studio
4. Java => IntelliJ IDEA
5. Ruby => Ruby Mine
6. C & C++ => CLion
👍1
Hidden Python Features for Beginners

1
. Merge Dictionaries

>>> d1 = {"a":1, "b": 2}
>>> d2 = {"c":3, "d":4}
>>> dict(d1, **d2)
{’a’: 1, 'b’: 2, 'c’: 3, 'd’: 4}
>>> {**d1, **d2}
{’a’: 1, 'b’: 2, 'c’: 3, 'd’: 4}
👍1
Which programming language should I use on interview?

Companies usually let you choose, in which case you should use your most comfortable language. If you know a bunch of languages, prefer one that lets you express more with fewer characters and fewer lines of code, like Python or Ruby. It keeps your whiteboard cleaner.

Try to stick with the same language for the whole interview, but sometimes you might want to switch languages for a question. E.g., processing a file line by line will be far easier in Python than in C++.

Sometimes, though, your interviewer will do this thing where they have a pet question that’s, for example, C-specific. If you list C on your resume, they’ll ask it.

So keep that in mind! If you’re not confident with a language, make that clear on your resume. Put your less-strong languages under a header like ‘Working Knowledge.’
Data structures playlist
by WilliamFiset
🎬 14 video lessons
9 hours worth of material
🔗 Courses link
Most popular backend frameworks 2020
What's the Interview Process Like, In a Nutshell?

If I were asked to summarize all the resources above to you, here's what I would share:

🔹 I would say that you typically get between 30 minutes to an hour to solve a coding question.
🔹 You typically get a choice of programming language like C++, Python, Java, or JavaScript, but not always...in some instances you do not have a choice.
🔹 Outside of the coding portion, they are free to ask you pretty much anything, from language-specific questions to favorite projects, but any interview with a coding portion tends to be dominated by it.

And here's some general advice to consider: you are going to be dealing with people who may be pretty tired of interviews. Smile if you can. Try to show enthusiasm. Have a conversation, and try to talk to the interviewer the way you might communicate if the two of you were pair programming, but they were more senior.
General tips

Always validate input first. Check for inputs that are invalid, empty, negative, or different. Never assume you are given the valid parameters. Alternatively, clarify with the interviewer whether you can assume valid input (usually yes), which can save you time from writing code that does input validation.

Are there any time and space complexities requirements or constraints?

Check for off-by-one errors.

In languages where there are no automatic type coercion, check that concatenation of values are of the same type: int,str, and list.

After you finish your code, use a few example inputs to test your solution.

Is the algorithm supposed to run multiple times, perhaps on a web server? If yes, the input can likely be pre-processed to improve the efficiency in each API call.

Use a mix of functional and imperative programming paradigms:

🔹 Write pure functions as often as possible.
🔹 Use pure functions because they are easier to reason with and can help reduce bugs in your implementation.
🔹 Avoid mutating the parameters passed into your function, especially if they are passed by reference, unless you are sure of what you are doing.
🔹 Achieve a balance between accuracy and efficiency. Use the right amount of functional and imperative code where appropriate. Functional programming is usually expensive in terms of space complexity because of non-mutation and the repeated allocation of new objects. On the other hand, imperative code is faster because you operate on existing objects.
🔹 Avoid relying on mutating global variables. Global variables introduce state.
🔹 Make sure that you do not accidentally mutate global variables, especially if you have to rely on them.
Distribution of the types of problems that were generally encountered in an Apple interview.
Why do companies really like using Java, rather than other languages?

Why do the companies which use Java use it?

It's easy to find professional programmers who know Java.
It's easy to find college hires who know Java.
The language is mature, with good tools for development, debugging, performance analysis, and so on.
There are a large number of open source libraries available providing additional functionality which can make new projects faster and more stable.
It's perceived as being easier to write and maintain than C or C++, which would be its main competitors.
Industry programming is a popularity contest, not a beauty contest. It's about critical mass of support and knowledge, not the esoteric beauty and purity of the language. This changes very slowly with many people paying a price as the popularity of a 'new' language grows.

Choose an unpopular language for commercial projects, and you risk having your code discarded or deprecated. You'll certainly have a smaller set of people you can recruit to work in it.

John L. Miller
25 years at Microsoft, Amazon, Google, etc