Book Image

The Complete Coding Interview Guide in Java

By : Anghel Leonard
Book Image

The Complete Coding Interview Guide in Java

By: Anghel Leonard

Overview of this book

Java is one of the most sought-after programming languages in the job market, but cracking the coding interview in this challenging economy might not be easy. This comprehensive guide will help you to tackle various challenges faced in a coding job interview and avoid common interview mistakes, and will ultimately guide you toward landing your job as a Java developer. This book contains two crucial elements of coding interviews - a brief section that will take you through non-technical interview questions, while the more comprehensive part covers over 200 coding interview problems along with their hands-on solutions. This book will help you to develop skills in data structures and algorithms, which technical interviewers look for in a candidate, by solving various problems based on these topics covering a wide range of concepts such as arrays, strings, maps, linked lists, sorting, and searching. You'll find out how to approach a coding interview problem in a structured way that produces faster results. Toward the final chapters, you'll learn to solve tricky questions about concurrency, functional programming, and system scalability. By the end of this book, you'll have learned how to solve Java coding problems commonly used in interviews, and will have developed the confidence to secure your Java-centric dream job.
Table of Contents (25 chapters)
1
Section 1: The Non-Technical Part of an Interview
7
Section 2: Concepts
12
Section 3: Algorithms and Data Structures
19
Section 4: Bonus – Concurrency and Functional Programming

It’s all about getting the right experience

You know what you want and what the market offers. This is cool! Now it’s time to get the right experience! Without experience, there is no resume, and without a resume, there is no interview, therefore, this is a major and laborious step. The following subsections will help you to achieve two main goals:

  • Accumulate a lot of technical knowledge and skills.
  • Gain trust and visibility across the Java ecosystem.

Pay attention – these two goals won’t materialize overnight! It takes time and requires perseverance, but there is a clear and guaranteed result – you’ll become a top Java developer. So, let’s start something!

Start something

For a student or a recent graduate, it is pretty hard to decide where to start from in order to gain experience and write a resume. You are aware that you should start something, but you cannot decide what that something should be. Well, that something should be code. Before you have any formal work, get involved in school projects, internships, programming, volunteering work, and any kind of practical experience.

It’s time to shine online

It is mandatory to get online and show the world what you can do as early as possible (for example, from school). Companies and programming communities are looking forward to seeing how you grow online. But just before you jump in, ensure that you follow the next two golden rules:

  • It is very important to pay attention to the identity used to expose your work online. Don’t use dummy credentials, avatars, nicknames, emails, passwords, and so on. Most likely, the accounts that you will create now (on GitHub, Stack Overflow, LinkedIn, YouTube, Twitter, and so on) will be shared all over the internet and will make you famous. Always use your complete name (for example, Mark Janel, Joana Nimar), use a relevant photo of yourself for your profile (as in the following figure), and use your name in accounts (for example, @markjanel, joananimar) and in emails addresses (for example, [email protected]). It is more difficult for dummy names, emails, and nicknames to become associated with you and with your work:
Figure 1.5 – Using a relevant photo

Figure 1.5 – Using a relevant photo

  • Always accept criticism and be polite. Exposing your work online is going to attract critics. An extremely small percent of what you receive will be really malicious comments with no logical arguments. The best practice, in this case, is to ignore such comments. But most critics will be positive and constructive. Always answer to such comments with arguments and always be polite. Common sense is the most important skill! Be open and stay open to other opinions!

Do not get disappointed or frustrated. And never give up!

Contribute to open source projects

Contributing to open source projects is a supersonic approach for measuring your skills and quickly gaining experience and visibility to companies looking for candidates. Don’t underestimate yourself! Small contributions count as well. Even reading and understanding the code of an open source project is a great opportunity to gain coding experience and learn coding techniques.

A lot of open source projects encourage and support developers to contribute. For example, check out the Hibernate ORM open source project in the following screenshot:

Figure 1.6 – Contributing to an open source project

Figure 1.6 – Contributing to an open source project

You have the chance to add your footprint to the code that you will use later in your daily work! And it is also used by millions of developers. How cool is that!?

Start your own GitHub account

Besides contributing to open source projects, it is advisable to start your own GitHub account. Employers will evaluate the content of your GitHub profile before they meet you. Don’t neglect any aspect! Take your time and clean up your GitHub profile so it reflects your best code. Keep in mind that the worst kind of GitHub account is an empty account or an account that shows low activity on a long-term basis, as shown on the left in the following screenshot:

Figure 1.7 – GitHub contributions over four months

Figure 1.7 – GitHub contributions over four months

Demonstrate a preference for clean code and meaningful README.md files and avoid periods of low activity on a long-term basis, as shown in the previous screenshot.

Start your own Stack Overflow account

Stack Overflow is the next stop for companies that evaluate your work. Your questions and answers on Stack Overflow will appear in Google searches, therefore, you have to pay extra attention to what you post (questions and answers). As a rule of thumb, your questions may reveal your level of knowledge, therefore, don’t post simple questions, questions that have easy answers in the documentation, questions that sit behind trivial programming challenges, and so on. On the other hand, make sure to provide valuable answers and don’t repeat other people’s answers. Provide content that will bring you badges, not downvotes. Link your GitHub profile to your answers to provide complete solutions.

Start your own YouTube channel

Besides entertainment, YouTube is also a huge source of technical knowledge. On YouTube, you can post complete coding solutions that show people how to program and how to become better programmers. You can quickly increase your YouTube subscribers if you do the following:

  • Don’t go for long videos (stick to 10-20-minute lessons)!
  • Ensure that you have a good webcam and microphone. A good webcam has at least 1080p resolution, and a good microphone is the Snowball ICE; for recording use free or low-cost tools such as Free2X Webcam Recorder (free2x.com/webcam-recorder) and Loom (loom.com); Camtasia Studio is also awesome (techsmith.com/video-editor.html).
  • Demonstrate excellent English skills (English is used most commonly on YouTube).
  • Introduce yourself (but do it quickly).
  • Be enthusiastic (show people that you enjoy your work, but don’t exaggerate).
  • Be practical (people love live coding).
  • Take the chance to prove your speaking skills (this opens you the door to technical conferences).
  • Promote your work (add links and hints for more videos, source code, and so on).
  • Respond to people’s feedback/questions (don’t ignore what people say about your video).
  • Accept criticism and be polite.

Link your GitHub and Stack Overflow accounts to your YouTube videos to get more exposure and followers.

Start your technical blog

Your awesome work on GitHub, Stack Overflow, and YouTube can easily be promoted in stories on a technical blog. Write about programming topics, especially about programming problems that you solved, and write tutorials, tips and tricks, and so on. Constant posting and high-quality content will increase your traffic and will index your blog on search engines. Someday, this valuable content can be exploited to write an astonishing book or develop a great video on Udemy (udemy.com) or PluralSight (learn.pluralsight.com).

There are a lot of blogging platforms such as Blogger (blogger.com), WordPress (wordpress.org), and Medium (medium.com). Choose the one that you prefer and get started.

Write articles and attract huge traffic and/or get paid

If you want to post technical articles and earn money or attract a huge amount of traffic to your work, then a personal blog will not be very useful, at least not for a significant amount of time (1-2 years). But you can write technical articles for websites that register huge amounts of daily traffic themselves. For example, DZone (dzone.com) is a great technical platform where you can write for free or you can join different programs where you are paid for your work. By simply creating a free DZone account, you can immediately start publishing technical articles via their online editor. In 1-5 days, they will review your work and publish it online. Almost instantly, thousands of people will read your articles. Besides DZone, other great technical platforms will pay you to write for them (commonly between $10-$150 per article depending on length, topic, internal policies, and so on). Some of these platforms include InformIT (informit.com), InfoQ (infoq.com), Mkyong (mkyong.com), developer.com (developer.com), Java Code Geeks (javacodegeeks.com), GeeksForGeeks (geeksforgeeks.org), and SitePoint (sitepoint.com).

Promote yourself and your work (portfolio)

It’s important to work, but it is also important to show people what you’ve done and get their feedback.

Important note

Managing your online profile is very important. Recruiters use online profiles to find desirable candidates, to get to know you better, and to prepare in-depth or custom interview questions.

Along with GitHub, Stack Overflow, and so on, recruiters will search your name on Google and will check your personal website and social network profiles.

Personal websites

A personal website (or portfolio) is a website that shows off your work. Simply add the screenshots of applications that you’ve made/contributed to and give brief descriptions of your work. Explain your role in each project and provide a link to the project. Pay attention to not expose private and proprietary company information. You can quickly get inspiration from the internet (for example, codeburst.io/10-awesome-web-developer-portfolios-d266b32e6154)

For building your personal website, you can rely on free or low-cost website builders such as Google Sites (sites.google.com) and Wix (wix.com).

Social network profiles

One of the most important social networks is Twitter. On Twitter, you can promote your work in front of the best Java developers in the world. Right from day 1, search and follow the best Java developers, and soon they will follow you too! As a tip, start to follow as many Java Champions (an exclusive community of the best Java developers in the world) you can find. There is a huge and valuable community of Java developers on Twitter. Get to know them as fast as you can!

Other social networks such as Facebook and Instagram are also scanned by recruiters. Pay attention to the content of your posts. Obviously, radicalism, racism, fanaticism, trivial or sexual content, political content, slogans and incitement to violence, defamatory and offensive content, and so on will cause the recruiter to take a step back.

CodersRank matters

CodersRank (codersrank.io/) is a platform that harvests information about your work (for example, it harvests information from GitHub, Stack Overflow, Bitbucket, HakerRank, and so on) and tries to rank you against millions of other developers from around the world. In the following screenshot, you can see a developer’s profile page:

Figure 1.8 – CodersRank profile summary

Figure 1.8 – CodersRank profile summary

This is another important barometer for recruiters.

Learn, code, learn, code...

Once you become a developer, you must follow the Learn->Code practice in order to get on top and stay there. Never stop learning and never stop coding! As a rule of thumb, the Learn->Code practice can be applied via the learning by example or teaching is my way of learning approaches, or any other approach that fits you best.

How about certifications?

Once you access education.oracle.com/certification, you can see that Oracle provides a suite of Java certifications. While there’s nothing wrong with getting certifications (from Oracle or an other party), they are not required in job descriptions. Taking these certifications requires a significant amount of money and time, and most of the time they don’t pay off the effort. You can use this time more wisely and get involved in projects (side projects, school projects, open source projects, and so on). This is a better way to impress employers. So, certificates have limited value and it takes a lot of resources to obtain them. Moreover, certificates are perishable. Think how useful it is today, in 2020, to be Java 6 certified, or in 2030 to be Java 12 certified!

But if you really want to consider certifications, then here are the top certifications on offer (for more information, search on Google for them since links can break over time):

  • OCAJP (Oracle Certified associate, Java Programmer 1) and OCPJP (Oracle Certified Professional, Java Programmer 2)
  • Spring Professional Certification
  • OCEWCD (Oracle Certified Expert, Java EE 6 Web Component Developer)
  • Apache Spark Cert HDPCD (HDP Certified Developer)
  • Professional Scrum Master
  • Project Management (PMP)
  • AWS Solutions Architect
  • Oracle Certified Master

Having experience and visibility (fans) all over the internet is a tremendous plus in your career. But you still need a useful resume for applying to Java jobs. So, it’s time to write your resume.