Learn DSADSAContests
coding75 logo
LeetCode POTDPOTDSheets
coding75 Pro
coding75 logo
Dashboard
Learn DSA
Course RoadmapFlow
DSA Topic TreeNew 🚀
Contest SolutionsPractice
Practice Sheets
MasterclassesLive 👨🏻‍💻

coding75 ProPRO

Live Classes & Placement Guidance

coding75 logo

The premier developer platform for mastering Data Structures & Algorithms, exploring contest editorials, building ATS-ready resumes, and accelerating your tech career.

Connect & Community

DSA & Contests

  • Learn DSA
  • Contest Solutions
  • LeetCode POTDDaily
  • Practice Sheets
  • MasterclassesSoon

Interview Prep

  • Portfolio Projects
  • CS Fundamentals
  • System DesignSoon
  • Interview ExperiencesSoon
  • Mock InterviewsSoon

Career & Pro

  • Jobs & Internships
  • Resume BuilderATS
  • coding75 Pro
  • Submit Feedback
© 2026coding75•crackDSA™•Maa Lalita Edtech Private Limited. All Rights Reserved.
Privacy PolicyTerms & ConditionsContact Support
Registered Office: Kanpur 208021•Regional Office: Indiranagar, Bangalore, 560008
Maa Lalita Edtech Private Limited
Contests/CodeChef/Starters 147/Truth Teller And Liars 101
PrevNext
CodeChefCodeChef
3 Star
Starters 147

Truth Teller And Liars 101

Math
Loading...
Solve on CodeChef

Problem Statement

Official algorithmic problem description and constraints.

Open on CodeChef

You are a traveler and you are at a junction of 2 paths - one leads to eternal happiness, the other to certain doom.


There are a total of N+M people, N of which always tell the truth, while the remaining M may tell the truth or lie. All of them are aware of which path leads to where.

You don't know who is a truth teller and who is not. You will ask some randomly chosen X people the following question :

  • Which among the 2 paths leads to eternal happiness?

Is it possible for you to be sure which paths leads to eternal happiness?

If it is possible, find the minimal X where you can be sure of the path regardless of which X people you end up asking. Otherwise, print −1.

Solutions & Walkthrough

Detailed video explanations, mathematical intuition, and clean C++ implementation code.

Connecting secure classroom stream...
Back to Starters 147
Previous ProblemNext Problem