Author: The CodeFights Team

Intro to Hash Tables

Intro to Hash Tables

Hash tables are a must-know data structure for technical interviews. They’re used to store unordered collections of (key, value)pairs, in which the key must be unique. Item lookup by key, inserting a new item, or deleting an item are all fast operations – approximately O(1). Because they give you quick and cheap insertion, deletion, and lookups, you’ll be able to use them to solve many different types of interview questions.

When should you use a hash table?

Some common interview questions in which you should probably use a hash table are:

  • When there’s a unique, non-arbitrary identifier that you can use as a key for lookup. (Example: A caller ID function that uses a person’s phone number to retrieve their information.)
  • You need to quickly determine whether an element belongs to a collection. In these cases, you can represent the collection as a hash table with the elements as keys. (Example: A Scrabble checker that determines if a word is valid or not.)
  • You’re solving a problem about invariants. (Example: Checking whether a word has an anagram.)

To get a good basic introduction (or reintroduction) to hash tables and how you can use them, watch our Intro to Hash Tables tutorial video!

(For even more information about hash tables, check out the Hash Tables section in any of our Interview Practice learning plans.)

Practice makes perfect!

When you feel ready to practice on some real interview questions about this data structure, head to Interview Practice on CodeFights. Sign up for one of our technical interview learning plans. (No matter which one you choose, you’ll have access to the hash tables section.) You’ll learn more about them in our hash tables topic overview, and you’ll solve real interview questions about them. All that practice will get you good at recognizing when to use them and how to implement them during technical interviews!

Join the Beautiful JavaScript Challenge!

Join the Beautiful JavaScript Challenge!

Check out the Beautiful JavaScript challenge on CodeFights! You must submit your solution by noon on July 26. See the Official Rules at the end of this post for more details.

At CodeFights, we heart JavaScript. A lot. In fact, we love it so much that our whole stack, front-end and back-end, is JavaScript. Node + React + Meteor FTW!

We know we’re not the only ones who feel this way, and we want to share the JavaScript love. That’s why we’re launching our first-ever Beautiful JavaScript challenge today!

Think of this challenge as a beauty pageant for code. Write your solution in the most elegant JavaScript you can, polish it up, then click Submit. Our panel of judges, the senior engineers here at CodeFights, will be looking for code that’s expressive, readable, and concise. They’re going to choose the three most beautiful solutions to this challenge as the winners!

If you win, you’ll receive an all-inclusive trip to San Francisco, including a round-trip ticket from any city in the U.S. and three nights at a hotel downtown. And of course you’ll get to come hang out with us at CodeFights HQ and nerd out about all things JavaScript and CodeFights!

Excited yet? Yeah, so are we! We can’t wait to see the great solutions that you come up with. Join the Beautiful JavaScript challenge on CodeFights!

Official rules for Beautiful JavaScript:

  • All CodeFighters can solve this challenge, but only people in the U.S. are eligible to win.
  • You must write your solution in JavaScript, obviously!
  • Your solution must be submitted before the contest closes at 12:00 PM Pacific Time on Wednesday, July 26.
  • The three winners will be notified by email and their names will be posted on the CodeFights forum by 5:00 PM Pacific Time on Friday, July 28.
Ace Your Next Interview With CodeFights

Ace Your Next Interview With CodeFights

You know that you need to prepare for technical interviews – right? Of course you do! Companies rely on technical interviews to weed out people who can’t cut it. And for qualified candidates, they’re used to gauge aptitude, interest, and intelligence. So the stakes are really high, and you need to do everything you can to give yourself a competitive edge.

But it can be hard to know what exactly to study. There’s so much information out there, and sometimes it feels like you have to know everything. If you start studying without a plan, you risk wasting your time by preparing for the wrong sorts of questions, not studying enough, or any other issue that might hamper your ability to knock the interviewer’s socks off. And we want those interviewer’s socks to be knocked all the way off! In other words, we want to make sure that you ace your next technical interview.

That’s why we’ve made some changes to Interview Practice that make it an even better interview prep tool. Now you can join a study plan that gives you a timeline and a way to track your progress (or you can create your own plan). Each study plan has essential topic overviews and real interview questions from real companies. This makes it easy to know what topics to cover and how much to study.

Choose a study plan

Each study plan covers the most commonly-asked interview topics that you should prepare for, given the amount of time before your interview.

  • Crash Course: As the name implies, the Crash Course is perfect for when you have a technical interview coming up soon! This study plan will get you up to speed on computer science fundamentals. These are common topics that you must know in order to do well on interviews. Choose this plan if you have two weeks (or less) to prepare for an interview.
  • Fundamentals: If you have an interview coming up in the next 2-6 weeks, this is the perfect study plan for you. Since you’ve got a little more time to prepare, the Fundamentals plan covers some other common topics like bits, strings, sorting algorithms, and useful problem-solving techniques.
  • Extra Credit: If you plan to start interviewing at some point in the future, but don’t have any specific plans yet, check out the Extra Credit study plan. Extra Credit covers big topics like number theory, counting, and geometry. These concepts are really important but don’t get asked as often in interviews.
  • Freestyle: If none of these options is exactly what you need, don’t worry. It’s quick and easy to create a Freestyle plan! Just select the topics that you need to study and the amount of time you have before your interview, and our system will create a customized study plan for you to follow.

Once you’ve chosen a study plan, Interview Practice keeps you on track by recommending a minimum number of coding tasks to solve each day – and reminding you to start hustling if you’re not meeting your daily quota!

Study important concepts

A mainstay of the technical interview process is asking questions that help the interviewer determine how well you understand computer science fundamentals like data structures and algorithms. The interviewer is also assessing whether you can implement these concepts appropriately, and whether you take time and space complexity into account. Depending on where you are in your career, some of these topics might be ones that you haven’t touched since you were in school. Or maybe you’ve never formally studied them.

Interview Practice gives you a refresher course on these common interview topics. You need to be strong on these in order to do well in technical interviews, whether you’re a junior developer or have been in the field for years.

Study important interview concepts.

Solve actual coding problems

The questions you get asked in technical interviews are aimed at making sure that you have a fundamental understanding of how to write code. The interviewer also wants to make sure that you take edge cases and optimization into account. While you’re whiteboarding, interviewers are also gauging how you think while you’re working through a problem.

Actually writing code that solves the actual technical interview questions makes you more comfortable with the process. We can’t emphasize this enough. The absolute best way to ensure that you’re good at interviewing is to practice solving coding interview problems!

Each topic in Interview Practice has real interview questions from real companies for you to practice on, ordered by difficulty. As you solve them, you’re solidifying your knowledge of the topic and becoming familiar with this kind of problem.

Get going!

Interview Practice gives you a plan and helps you stick to it. This eliminates the guesswork about what you need to study,  how much you needs to study, and how you should organize your time. Work your way through each topic, reviewing each concept in the overview and solving the questions. As you practice, you’re becoming a better programmer. You’re also giving yourself a serious advantage in technical interviews!

Time to get started! Head to CodeFights and get started on the new and improved Interview Practice today.

April Marathon Recap

April Marathon Recap

As you may have heard (from us, because we won’t stop talking about it), CodeFights hosts a monthly coding competition that we call the Marathon. CodeFights Marathons, unlike their IRL counterparts, only last for one hour. And while you may not get a medal and a free banana afterwards, the top ten participants do get $50 Amazon gift cards, not to mention coins and XP! Our content engineers create brand new challenges for each Marathon, all tricky, fun, and guaranteed to get your brain in gear.

We had a great turnout this month. Over 800 people registered! But of course, there could only be 10 top coders… and only one winner.

CodeFighterLanguage UsedScoreTimeChallenges Completed
Alex_2oo8Python (Python2)300042:4410
xiaowuc1 (who won our live San Francisco tournament the week before!)Java300049:1210
eatmorePython (Python3)300049:5610
Lewin_GJava300058:0710
GassaPython (Python2)270050:229
benqC++251558:529
dojiboy9C++240051:058
albert96C++240056:588
yenthanh132C++240058:368
cows_go_mooRuby221542:278

Congrats to our top ten competitors, and a big high five to CodeFighter Alex_2008 for coming out on top!

CodeFights CEO and founder Tigran Sloyan and Content Engineer Damien Martin (author of our awesome new CodeFights Solves It and CodeFights Explainer series) provided live commentary during the competition. If you missed the tournament or the live broadcast, we’ve got you covered. You can take a look at the questions from the Marathon and watch a video of the commentary at the same time!

Thank you to everyone who participated and/or watched the live broadcast!

The May Marathon will be here before we know it, so mark May 27 off on your calendar! We’ll post the registration link soon.

The monthly Marathon is a great way to get in some solid coding during the weekend. We love seeing repeat competitors getting better each month they participate in a Marathon. Practice makes perfect! Whether you’re preparing for technical interviews or just becoming the best coder you can be, competition is a great way to hone your skills.

Previously on CodeFight On!

March Marathon Recap

Tell us…

Did you watch the April Marathon? Did you participate? Either way, let us know what went well and what we can do better!

April Marathon and Live Broadcast

April Marathon and Live Broadcast

You might not know that every month we run a huge coding tournament. We call them Marathons, but unlike a running marathon, they only last one hour. (And your legs won’t hurt tomorrow!) Each Marathon consists of 10 questions that have been specially created by our team of Content Engineers. They’re fun, they’re tricky, and they’ll get your brain in gear! And if you’ve never participated in a competitive coding event before, this is the perfect introduction.

Participate

If you want to compete in the Marathon, sign up on CodeFights. As of this second, 730 people have signed up, but thanks to the magic of the internet we’ve got enough room for everyone who wants to join us. You can register even after the Marathon starts, but don’t wait too long!

Watch

Even if you don’t want to participate in the Marathon, we’ve got a great way for you to join us. CodeFights CEO Tigran Sloyan and Content Engineer Damien Martin will be broadcasting live and providing commentary the whole time! Watching other people code, and getting play-by-play explanations of how the coders are solving the challenges, isn’t just fun. It’s also a great way to learn about coding and level up your own skills and understanding! To watch the live commentary, head over to our Facebook page.

Join us for this coding Marathon!

So whether you’re participating in the April Marathon tomorrow or just want to watch the action as it unfolds, we’ve got lots of coding goodness for you tomorrow! Both the Marathon and the live broadcast start tomorrow, April 29, at 10AM PDT.

Previously on CodeFight On!

March Marathon Recap

 

San Francisco Live Tournament Recap

San Francisco Live Tournament Recap

On Saturday, April 22, CodeFighters from all over the Bay Area packed into the new CodeFights office and made history at the first-ever live San Francisco tournament.

Some long-time CodeFighters already knew each other, but for many it was their first time meeting up with other users in real life. The room rang with friendly chatter… right up until the tournament started, and then everyone got down to business.

CodeFights office during live coding tournament

The packed room was nearly silent during the hour-long tournament. CodeFighter xiaowuc1 pulled ahead early, solving all 10 challenges in under 15 minutes.

12 people were able to complete all 10 questions in the hour allotted, while 4 users finished 9 questions, 3 finished 8 questions, and the rest of the pack finished 7 or fewer. The questions started off fairly innocently and then ramped up in difficulty quickly! The last few were especially tricky:

  1. isEarlier
  2. onlyEvenNumbers
  3. lrSegmentNumber
  4. sequencePeakElement
  5. parkingCost
  6. findPath
  7. numberOfCarries
  8. holesErasing
  9. rangeCollapseRepresentations
  10. subdomains

Check out xiaowuc1 explain how he solved subdomains using tries:

Our winners!

1st Place

Taking top position by a wide margin, xiaowuc1 (Nick Wu) solved all 10 challenges in a blistering fast 14 minutes 28 seconds. His language of choice for solving these questions was Java.

xiaowuc1, live CodeFights tournament first place

2nd Place

Coming in second, cows_go_moo (Anton Cao) completed the tournament in 27 minutes and 39 seconds. He solved the challenges in Ruby. Keep an eye on this guy – he’s going to be an intern at CodeFights this summer!

cows_go_moo, CodeFights live tournament second place

3rd Place

Our third place competitor was ahmed_aly (Ahmed Aly), who finished the challenges in 38 minutes and 36 seconds using C++.

ahmed_aly, CodeFights live tournament third place

Special Shoutout

While he wasn’t able to make it into the city to compete in person, CodeFighter Pedro_O (Pedro Osório) participated remotely, solving the challenges in Python. He finished in 33 minutes and 33 seconds.

Thanks!

We had so much fun hosting this! Thanks to everyone who came out to compete, meet other CodeFighters, and hang out with the CodeFights team. It was great meeting you all!

We’ll definitely be holding more live coding tournaments in the future. In fact, it’s going to become a regular event! We’ll let you know when the next one’s scheduled – and hopefully we’ll see you there!

CodeFight on!

 

 

Interview Practice Task of the Week

Interview Practice Task of the Week

Have you been using our Interview Practice module to prepare for technical interviews? If not, you definitely should be!

Interview Practice has over 100 questions that get asked by top companies during real interviews. (Which companies, you ask? Oh, you know. Just lil’ companies like Apple, Facebook, Google, Microsoft, Twitter, and more.) The topics are ones that you’ll definitely encounter – coding patterns, algorithms, and data structures. You need to be strong these topics in order to do well in technical interviews, whether you’re a junior developer or have been in the field for years.

We’re adding more questions on more topics from more companies all the time, so you’re not going to run out of questions any time soon. In fact, it can be a little bit overwhelming – which challenge should you tackle first? A general rule of thumb is to choose questions based on where you’re interviewing and on topics that you need to study.

Where you’re interviewing

Interviewing at Facebook? Then it’s a given that you should practice using the Facebook Interview Practice questions!

But if we don’t have questions from the company that you’re interviewing with, use the resources at your disposal to find out what sort of questions typically get asked during their interviews. Glassdoor often has this kind of info, so it’s a good place to start researching. And leverage your professional network! Do you know anyone who’s interviewed at (or worked for) the company? Reach out to them and get the inside scoop.

Topics that you need to study

The list of things that you need to study will be largely informed by the research that you’ve done about the company you’re interviewing with. If you know that a company is likely to ask you questions about graph traversal, you can start working on graph traversal interview questions to prepare.

This is an instance in which knowing and being honest with yourself about your skills is critical too. For example, you may have known basic data structures inside and out as a computer science undergraduate. But if you’ve been working as a front-end developer for the past two years you might be a little rusty. Time to start practicing!

Studying != cheating

It’s pretty unlikely that you’ll be asked the exact same questions that we have here in Interview Practice or that are listed on Glassdoor. But researching questions that have been asked in the past is just plain smart, and a great way to set yourself up for success. The goal here isn’t to memorize the answers to a narrow set of questions. You’re not cheating! And really, even if that was your goal, interviewers pick up on that sort of thing really quickly. Rather, the goal is to be as prepared as possible for your interview.

Task of the Week

If you’re not sure where to start, we suggest that you tackle the Interview Practice Task of the Week! Every week, CodeFights content engineers select a new challenge to feature. They choose these interview questions because they’re tough ones that will get you into an interviewing mindset. Once you’ve solved the challenge, check out other CodeFighter’s solutions. It can be extremely instructive to see how other people have solved the same problem. Speaking of which…

CodeFights Explains It

Every Thursday, our content engineer Damien Martin writes a CodeFights Explains It editorial that breaks down how to solve the past week’s Task of the Week. He also tackles issues that are likely to come up during an interview. (Think optimizing your solution and working with interviewer-imposed restraints.) Make sure that you’re reading this series every week! It’s a great supplement to your interview preparation routine.

Tell us…

Have you solved an Interview Practice Task of the Week yet? How are you fitting Interview Practice (and CodeFights in general) into your interview preparation? Let us know over on the CodeFights forum!

Live Tournament in San Francisco

Live Tournament in San Francisco

Bay Area CodeFighters, come join us on Saturday, April 22, for a special event: We’re breaking in our new San Francisco office by hosting a special live one-hour tournament!

Meet the CodeFights team, hang out with other Bay Area coders, and compete for bragging rights, prizes, and CodeFights swag.

The top three participants will all get $50 Amazon gift cards, and the first place winner will also get a special CodeFights gift box.

Tournament Details

2:30 – Check in, hang out, eat snacks
2:50 – Welcome from the CodeFights team
3:00 – Tourney begins
4:00 – Tourney ends
4:10 – More hanging out, more snacks, prizes!
4:30 – Doors close

Sign up on our Facebook event page.

See you there!

March Marathon Recap

March Marathon Recap

The March Marathon on March 25 was amazing! Over 700 CodeFighters signed up, but of course only one could win… And what a victory it was! Congratulations to CodeFighter urandom, who pulled off a stunning last-minute upset.

CodeFights Founder Tigran Sloyan and Content Engineer Damien Martin provided us with live commentary during the marathon. It was awesome to have them talk through the top solutions just minutes after they were submitted!

If you missed it the first time around, check out the recording here or on our YouTube channel.

You can also take a stab at the problems yourself on the archived page.

If you’re excited about the upcoming April marathon, well, join the club! We are too. Keep April 29 open on your calendar, and we’ll update you with the link to register soon. If you aren’t going to compete, Tigran and Damien will be doing another livestream so that you can watch the action as it unfolds!

Introducing Interview Practice

Introducing Interview Practice

Let’s not kid ourselves – preparing for interviews isn’t exactly fun. In fact, it can be downright nerve-wracking! The best way for you to be able to walk into an interview feeling poised and confident is to practice, practice, practice – and to know what to expect during the interview. But it’s hard to know what kind of questions you should practice when you’re preparing, and it can be even harder for you to gauge how well you’re doing when you’re practicing. That’s why CodeFights is giving you a new secret weapon to help you prepare for technical interviews – Interview Practice!

Introducing Interview Practice Mode!

Prepare for technical interviews

We created Interview Practice because we know that for you to succeed in a technical interview, you need to be able to solve real interview questions from real technical interviews. Interview Practice has 100+ real interview questions from 10+ top-rated companies (think Google, Facebook, and LinkedIn) on over 25 topics ranging from dynamic programming to hash tables to sorting algorithms. What – that’s not enough? Don’t worry, we’ll be adding more questions from even more companies over the next few months.

Interview Practice is on the same great CodeFights platform that you already know and love. It runs tests against your solutions in realtime, so you get instant feedback about how you’re doing. Since you get to choose challenges from specific companies that are about specific topics, you create a custom interview preparation experience instead of following a one-size-fits-all path. When you’re done with a challenge, compare your answer against solutions from other CodeFighters. And as always, you can ask questions and discuss strategies in the CodeFights forum.

Maybe you’re already looking for a new job. Or you’re considering looking for one. Or maybe you just want to know whether you can solve interview questions from a certain company – bragging rights are important! Whatever your goal, the CodeFights Interview Practice Mode is going to help you get there.

What are you waiting for? Start preparing for your next interview right now with CodeFights’ Interview Practice. You’ll walk in knowing that you’re prepared for anything the interviewer throws at you!  

Tell us…

Are you preparing for interviews right now? How are you going to integrate Interview Practice Mode into your interview prep routine? Let us know what you think on the CodeFights forum!