Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Alternate Printing With Threads

HardCoding00:00
Practice interviewer
In session
5 left
00:00

Your question is Alternate Printing With Threads. Take a moment with it on the right.

Talk me through your thinking if you like. When you're confident, submit your answer and I'll grade it like a real screen (7/10 or better passes).

You need to log in / sign up to chat or submit.

Problem

Suppose you have two threads t1 and t2, where t1 prints table 2 and t2 prints table 3; write a program that prints 2,3,4,6,6,9,8,12... (alternate tables).