0% found this document useful (0 votes)
14 views

Day 21 Coding Mock (1)

The document outlines the instructions for Round 1 of the TCS NQT 2025 Coding Mock Test, which includes a card game challenge. Participants must solve a problem involving maximizing scores by picking K cards from either end of a row of cards. The document provides input and output formats along with an example for clarity.

Uploaded by

Believer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Day 21 Coding Mock (1)

The document outlines the instructions for Round 1 of the TCS NQT 2025 Coding Mock Test, which includes a card game challenge. Participants must solve a problem involving maximizing scores by picking K cards from either end of a row of cards. The document provides input and output formats along with an example for clarity.

Uploaded by

Believer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

TCS NQT 2025

Round 1: Coding Mock Test


🔹 Instructions for Students:
Round 1 (30 minutes Question): Solve one
question per day from Set 1

Use free compilers:


C++: OnlineGDB
Python: Compiler
Java: JDoodle

Each question has test cases that must


pass for full marks.
Q21. The Card Game Challenge

You are participating in a unique card game where


several cards are arranged in a row. Each card has a
certain number of points written on it. Your goal is to
collect exactly K cards in such a way that your total
score is maximized.

However, there’s a catch! You can only pick cards from


either the beginning or the end of the row in each step.
Once a card is picked, it is removed, and you continue
picking until you have exactly K cards.

Your task is to determine the maximum score you can


achieve by strategically picking cards.

Input Format:
The first line contains an integer N, the number of
cards.
The second line contains N space-separated integers
representing the points on each card.
The third line contains an integer K, the number of
cards you must pick.
Output Format:
Print the maximum score that can be achieved by
picking exactly K cards optimally.
Input :
7
1234561
3

Output :
12

Video Solution: Watch Here

You might also like