How it works

When you're stuck on a problem, simply input it into our platform. CodeSage can analyze questions from all major competitive programming sites or any original coding challenge.

Behind the scenes, our sophisticated artificial intelligence model gets to work. This model has been trained on a vast dataset of thousands of solved competitive programming questions. It deconstructs your problem to understand its structure, identify patterns, and determine the optimal solving approach.

Instead of a direct solution, CodeSage provides a curated sequence of hints. These hints start with general guidance about the problem's concept and gradually become more specific, nudging you toward the implementation details. This method is designed to replicate the "aha!" moment of discovery, building your intuition.

If you've exhausted the hints and still need closure, you can unlock the complete solution. This final step includes a comprehensive, well-commented answer with detailed explanations on why it works, including time complexity analysis and alternative approaches. This ensures you learn from the solution, rather than just copying it.

With each problem you tackle, CodeSage tracks your progress. Over time, it identifies your strengths and weaknesses, helping you systematically improve your algorithmic thinking and coding proficiency. The goal is to make you a more independent and confident programmer, capable of tackling any challenge.

Problem Description
Your Submissions
Dashboard

Matrix Game

Aryan and Harshith play a game. They both start with three integers a, b, and k. Aryan then gives Harshith two integers n and m. Harshith then gives Aryan a matrix X with n rows and m columns, such that each of the elements of X is between 1 and k (inclusive).

After that, Aryan wins if he can find a submatrix Y of X with a rows and b columns such that all elements of Y are equal.

Problem ID3456246
CategoryGreedy
DifficultyEasy
Submission StatusAccepted
Evaluate Code Button
Submit File Button