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
- Quantitative Ability: Percentage, Profit and Loss, Ratio and Proportion (Ratios), Average, Time and Work, Speed Time and Distance, Simple Interest and Compound Interest, Age Problems, Number System, Divisibility Rules, HCF LCM, Algebra, Permutation and Combination, Probability, Data Interpretation, Logarithm, Sequence and Series (Series), Powers and Exponents (Surds and Indices), Speed Mathematics and Basic Mathematics
- Logical Reasoning: Seating Arrangements, Puzzle Solving (Puzzles), Data Arrangement, Coding Decoding, Blood Relations, Directions (Direction Test), Ranking, Order and Sequence, Data Sufficiency, Venn Diagram, Inequality, Series (Number and Letter Series) (Numerical Relations and Reasoning), Logical Sequence Of Words, Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning), Selection Decision Table (Decision Making), Analogy, Non Verbal Reasoning (Spatial Aptitude) (Spatial Reasoning) (Visual Reasoning)
- Verbal Ability: Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions), Subject Verb Agreement (Verb Noun Agreement), Tenses, Articles, Preposition, Conjunction, Modals, Active Passive Voice (Voice), Direct and Indirect Speech, Vocabulary, Sentence Re-arrangements (Para Jumbles) (Narrative Sequencing), Sentence Completion (Fill in the blanks), Sentence Correction (Error Correction), Cloze Test (Cloze Passage), Facts, Inference and Judgements
- Programming Fundamentals (Technical): C Fundamentals
- Data Structures (Technical): Introduction to DS, Array, Stack, Queue, Linked List, Tree, Graphs, Hashing
- Algorithms (Technical): Algorithm Analysis, Sorting Algorithms, Greedy Algorithms, Dynamic Programming, Minimum Spanning Trees, Shortest Path Algos, Time Complexity Analysis, Advanced Algorithms
- OOPs (Technical): Object Oriented Programming (OOPS)
- DBMS (Technical): Basics of DBMS, ER Diagram, Relational Model & Functional Dependencies, Keys & Integrity Constraints, Normalization (1NF - BCNF), Decomposition Properties & 4NF, File Organization & Indexing, Relational Algebra, Relational Calculus, Transaction Management, Concurrency Control, Database Recovery, ORDBMS, Database Security & Authorization, Query Processing & Optimization, Enhanced Data Models, Data Warehousing & Mining, Big Data Systems, NoSQL
- SQL (Technical): SQL
- Operating Systems (Technical): Introduction to OS, Process Management, CPU Scheduling, Process Synchronization, Deadlock, Threads & Process Creation, Memory Management, Virtual Memory, Disc Scheduling, File Management, Windows OS, Linux OS, Security, Distributed Systems, Virtual Machines
- Computer Networks (Technical): 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, TL: Congestion & UDP, Application Layer, Hardware basics, Network Security, Cloud Computing and IoT, Cyber and Info Security
- Software Engineering (Technical): Fundamentals of Software Engineering, Software Requirements and Quality Assurance, Software Design, Estimation and Metrics, Software Testing, Software Maintenance and Configuration Management
- Coding/Automata Round: Coding Questions by Yash Sir, C Programming by Yash Sir, Programming in C++, Java, Python for Placements by Yash Sir, Pseudo Codes
- Personality / Behavioral Assessment: Behavioral Assessment (Behavioral Competency Profiling) (Psychometric Test)
- Writing Assessment: English Writing Ability
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.

