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
- Communication Round: Vocabulary, Subject Verb Agreement (Verb Noun Agreement), Tenses, Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions), Cloze Test (Cloze Passage), Sentence Correction (Error Correction), Sentence Completion (Fill in the blanks), Sentence Re-arrangements (Para Jumbles) (Narrative Sequencing), Direct and Indirect Speech, Active Passive Voice (Voice), Verbal Analogy (Word Based Analogy), Articles, Preposition, Conjunction, Sentence Construction, English Writing Ability, Communication Assessment
- Quantitative Aptitude: Ratio and Proportion (Ratios), Divisibility Rules, Data Interpretation, Mixture and Alligation, Permutation and Combination, Logarithm, Number System, HCF LCM, Speed Time and Distance, Percentage, Average, Powers and Exponents (Surds and Indices), Time and Work, Mensuration and Geometry, Age Problems, Pipe and Cistern, Probability, Profit and Loss, Simple Interest and Compound Interest, Algebra
- Analytical and Logical Reasoning: Series (Number and Letter Series) (Numerical Relations and Reasoning), Coding Decoding, Data Sufficiency, Non Verbal Reasoning (Spatial Aptitude) (Spatial Reasoning) (Visual Reasoning), Directions (Direction Test), Ranking, Order and Sequence, Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning), Selection Decision Table (Decision Making), Logical Sequence Of Words, Puzzle Solving (Puzzles), Syllogisms, Seating Arrangements, Calendar, Clock, Blood Relations, Cubes & Dices, Venn Diagram, Analytical Reasoning (Counting Figures Reasoning)
- Cognizant Gaming Aptitude: Gamified / Game Based Aptitude
- Java (Cluster 1): Java
- ANSI SQL MySQL (Cluster 1,2,3): SQL
- HTML, CSS, JavaScript (Cluster 1,3): HTML, CSS, JavaScript
- Python (Cluster 2): Python for Placements by Yash Sir
- Cloud Fundamentals (Cluster 2): Emerging Tech Trends
- C# (Cluster 3): C#
- OOPs: Object Oriented Programming (OOPS)
- Technical Assessment (Coding): Coding Questions by Yash Sir, C Programming by Yash Sir, Programming in C++, Pseudo Codes
- Data Structures: Introduction to DS, Array, Stack, Queue, Linked List, Tree, Graphs, Hashing
- DBMS: 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
- Operating Systems: 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: 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, Mobile Technology, Cloud Computing and IoT, Cyber and Info Security
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.