Find Maximum Goals in Penalty Shootout
Duration: 9 min
This video lesson is available to enrolled students.
Inside: a video lesson and guided study material.
Module outline
- Language Skills (English): Vocabulary Verbal Analogy (Word Based Analogy) Noun Pronoun Verb Adjectives Adverb Preposition Articles Conjunction Tenses Modals Subject Verb Agreement (Verb Noun Agreement) Determiner Active Passive Voice (Voice) Direct and Indirect Speech Sentence Correction (Error Correction) Sentence Completion (Fill in the blanks) Sentence Construction Sentence Re-arrangements (Para Jumbles) (Narrative Sequencing) Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions) Cloze Test (Cloze Passage)
- General Aptitude (Quantitative Ability): Percentage Ratio and Proportion (Ratios) Average Profit and Loss Simple Interest and Compound Interest Time and Work Pipe and Cistern Speed Time and Distance Mixture and Alligation Age Problems Partnership Number System HCF LCM Divisibility Rules Powers and Exponents (Surds and Indices) Algebra Data Interpretation Statistics Sequence and Series (Series) Logarithm Arithmetic
- General Aptitude (Reasoning Ability): Series (Number and Letter Series) (Numerical Relations and Reasoning) Coding Decoding Syllogisms Blood Relations Directions (Direction Test) Ranking, Order and Sequence Inequality Logical Sequence Of Words Seating Arrangements Puzzle Solving (Puzzles) Non Verbal Reasoning (Spatial Aptitude) (Spatial Reasoning) (Visual Reasoning) Cubes & Dices Venn Diagram Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning) Selection Decision Table (Decision Making) Analytical Reasoning (Counting Figures Reasoning) Clock Calendar Data Sufficiency Analogy
- Technical Skills MCQ - Data Structure: Introduction to DS Array Stack Queue Linked List Tree Graphs Hashing
- Technical Skills MCQ - Networking: Introduction to CN Data Communication DLL: Access Control DLL: Flow Control DLL: Error Control DLL: Framing Data Link Layer - Ethernet Net Layer: IPv4 & Proto Net Layer: IP Addressing Net Layer:Routing Protocol Transport Layer Services Application Layer Network Security
- Technical Skills MCQ - Operating System: Introduction to OS Process Management CPU Scheduling Process Synchronization Deadlock Threads & Process Creation Memory Management Virtual Memory File Management Windows OS Linux OS Security Virtual Machines
- Technical Skills MCQ - DBMS: Basics of DBMS ER Diagram Relational Model & Functional Dependencies Keys & Integrity Constraints Normalization (1NF - BCNF) File Organization & Indexing Relational Algebra SQL Transaction Management Concurrency Control Database Recovery Database Security & Authorization NoSQL
- Technical Skills MCQ - Software Engineering: Fundamentals of Software Engineering Software Requirements and Quality Assurance Software Design, Estimation and Metrics Software Testing Software Maintenance and Configuration Management
- Technical Skills MCQ - Cloud Computing: Cloud Computing and IoT
- Technical Skills MCQ - Cyber Security: Cyber and Info Security Security in Mobile and Wireless Computing
- Technical Skills (Coding): Coding Questions by Yash Sir C Programming by Yash Sir Programming in C++ Java Python for Placements by Yash Sir Object Oriented Programming (OOPS) DSA by Prashant sir Coding Questions Bank
AI summary & chapters
AI Summary
An AI-generated summary of this video lecture.
This video is a programming lecture from Knowledge Gate that explains and solves a competitive programming problem. The problem involves two strikers, Lohia and Gosu, and a goalkeeper, Prince, who are practicing penalty shots. The goal is to determine the maximum number of goals each striker can score given their initial energy (X and Y) and the goalkeeper's energy (Z). The rules state that each player's energy decreases by 1 for every attempt, and a goal is scored only if the goalkeeper's energy is greater than 1. The striker with the higher energy gets to shoot first, and the process continues until the goalkeeper's energy reaches 1. The instructor first presents the problem statement, then demonstrates a step-by-step solution on a chalkboard using the example values X=14, Y=8, and Z=5. Finally, the instructor provides a complete C code solution, explaining the logic of the while loop and the conditional checks for each player's turn.
Chapters
0:00 – 2:00 00:00-02:00
The video begins with the Knowledge Gate logo, followed by a slide that introduces the problem. The problem statement is displayed on a screen, which describes a scenario with three footballers: Lohia and Gosu as strikers and Prince as the goalkeeper. The task is to find the maximum number of goals scored by Lohia and Gosu. The rules are that each player's energy (X, Y, Z) decreases by 1 for every attempt, and a goal is only scored if Prince's energy is greater than 1. The input consists of the number of test cases and the three energy values. The output is the number of goals scored by each striker. The instructor, visible in a small window, begins to explain the problem, emphasizing that Lohia, being a junior player, is always favored for the penalty kick, which implies he goes first if both have the same energy.
2:00 – 5:00 02:00-05:00
The instructor transitions to a chalkboard to demonstrate the solution. He writes the initial values for the example: Lohia's energy (X) is 14, Gosu's energy (Y) is 8, and Prince's energy (Z) is 5. He explains the logic step-by-step, showing that Lohia shoots first because his energy is higher. He then simulates the process, writing down the energy levels after each attempt. For instance, after Lohia's first shot, X becomes 13 and Z becomes 4. He continues this process, noting that a goal is scored only when Z > 1. He shows that Lohia scores a goal when Z is 4, 3, 2, and 1, but not when Z is 0. He also demonstrates that Gosu will score goals when his energy is sufficient and Z is still greater than 1. The instructor uses arrows and calculations to illustrate the sequence of events.
5:00 – 8:33 05:00-08:33
The instructor moves to a code editor to provide a C program solution. He writes the code, starting with the necessary header and main function. He initializes variables for the energy values (x, y, z) and counters for goals (count1, count2). He then uses a while loop that continues as long as Prince's energy (z) is greater than 1. Inside the loop, he checks if Lohia's energy (x) is greater than 0. If so, he decrements x and z, and increments the goal counter for Lohia (count1). If Lohia's energy is 0, he checks if Gosu's energy (y) is greater than 0, and if so, he decrements y and z, and increments the goal counter for Gosu (count2). After the loop, he prints the final goal counts. The instructor explains that this logic correctly models the game's rules, ensuring the player with higher energy shoots first and that the game ends when Prince's energy reaches 1.
The video presents a comprehensive tutorial on solving a competitive programming problem. It follows a clear pedagogical structure: first, the problem is stated and its rules are explained. Second, a concrete example is worked through manually on a chalkboard to illustrate the logic and sequence of events. Third, a complete, functional C code solution is provided, with the instructor explaining the algorithm's implementation. The core concept is a simulation of a turn-based game with specific conditions for scoring and termination, which is effectively modeled using a while loop and conditional statements.

