Zero-Sum Game - GeeksforGeeks (2024)

    • DSA Course
    • DSA Tutorial
    • Data Structures
    • Algorithms
    • Array
    • Strings
    • Linked List
    • Stack
    • Queue
    • Tree
    • Graph
    • Searching
    • Sorting
    • Recursion
    • Dynamic Programming
    • Binary Tree
    • Binary Search Tree
    • Heap
    • Hashing
    • Mathematical
    • Geometric
    • Bitwise
    • Greedy
    • Backtracking
    • Branch and Bound
    • Matrix
    • Pattern Searching
    • Randomized

    Open In App

    Last Updated : 26 Feb, 2021

    Comments

    Improve

    Recommended Problem

    Divide and Subtract Game

    Show Topics

    Solve Problem

    Medium

    47.35%

    5.3K

    Zero-Sum Game:
    A zero-sum game is one in which no wealth is created or destroyed. So, in a two-player zero-sum game, whatever one player wins, the other loses. In this game, we can include at least two and a maximum to an infinite number of contestants. It assumes a version of perfect competition and perfect information.

    Let us consider a game in which n contestant takes part, and contestant i has Ni courses of action available to him. Then the number of outcomes to a play of the game will be N1, N2,……………, Nn. So, consider a possible outcome θ result in payment p(i, θ) to a contestant i. Then, the game is called a Zero-Sum Game, if every possible result θ, we have
    Zero-Sum Game - GeeksforGeeks (2)

    Lets us understand this by taking an example, three-man A, B, and C playing poker and put 100 bucks all, the winner takes all money. If A wins the game he gains 200 bucks but B and C lose 100 bucks each. So, the total payment to all contestants after the play is zero. Similarly, if B or C wins too.

    In financial markets, futures and options are considered non-zero games because contracts represent agreements between two parties and, if one investor loses, the asset is transferred to another investor. Poker, Gambling, Matching Pennies, Chess, Tennis are also some examples of Zero-Sum Game.



    A

    amartomar683

    Zero-Sum Game - GeeksforGeeks (3)

    Improve

    Next Article

    Water Game

    Please Login to comment...

    Similar Reads

    Game Theory (Normal form game) | Set 2 (Game with Pure Strategy) Game Theory (Normal – form game) | Set 1 (Introduction) Please go through the above article before proceeding. Given a payoff matrix. The task is to find the optimum strategies of the players. Solution: Player A is having 3 strategies - 1, 2 and 3, and player B is also having 3 strategies - 1, 2 and 3. Step 1: Find row minimum values for each row a 2 min read Game Theory (Normal-form game) | Set 3 (Game with Mixed Strategy) Consider the following payoff matrix with respect to player A and solve it optimally. Solution: If a game has no saddle point then the game is said to have mixed strategy. Step 1: Find out the row minimum and column maximum. Step 2: Find out the minimax and maximin values. Since minimax and maximin value of this game are not equal, this game has no 4 min read Game Theory (Normal-form Game) | Set 7 (Graphical Method [M X 2] Game) The payoff matrix of an M * 2 game consists of M rows and two columns. This article will discuss how to solve an M * 2 game by graphical method. Also, this article will discuss if more than two lines intersect the same point in the graph then how can a 2 * 2 payoff matrix be formed. Consider the below problem: Solution: First check whether the prob 3 min read Game Theory (Normal-form Game) | Set 6 (Graphical Method [2 X N] Game) The payoff matrix of a 2 * N game consists of 2 rows and N columns . This article will discuss how to solve a 2 * N game by graphical method. Consider the below 2 * 5 game: Solution: First check the saddle point of the game. This game has no saddle point. Step 1: Reduce the size of the payoff matrix by applying dominance property, if it exists. Thi 3 min read Remove all zero-rows and all zero-columns from a Matrix Given a matrix arr[][] of size N * M, the task is to print the matrix after removing all rows and columns from the matrix which consists of 0s only. Examples: Input: arr[][] ={ { 1, 1, 0, 1 }, { 0, 0, 0, 0 }, { 1, 1, 0, 1}, { 0, 1, 0, 1 } } Output: 111 111 011 Explanation: Initially, the matrix is as follows: arr[][] = { { 1, 1, 0, 1 }, { 0, 0, 0, 15+ min read Count the numbers that can be reduced to zero or less in a game Given two integers X and Y and an array of N integers. Player A can decrease any element of the array by X and Player B can increase any element of the array by Y. The task is to count the number of elements that A can reduce to 0 or less. They both play optimally for an infinite time with A making the first move. Note: A number once reduced to zer 10 min read Game Theory (Normal - form game) | Set 1 (Introduction) Game theory is a mathematical model used for decision making. It has applications in all fields of social science, as well as in logic and computer science. Game theory has come to play an increasingly important role in logic and in computer science. To be fully defined, a game must specify the following elements: the players of the game, the infor 4 min read Game Theory (Normal-form Game) | Set 5 (Dominance Property-Mixed Strategy) This article discusses how to solve a game by the dominance property with mixed strategy. Consider the below game: Solution: Find out the row minimum and column maximum values. Here Minimax value is not equal to Maximin so this game has no saddle point. Now proceed with dominance property to reduce the rows and the columns. Reducing the row and the 2 min read Combinatorial Game Theory | Set 2 (Game of Nim) We strongly recommend to refer below article as a prerequisite of this. Combinatorial Game Theory | Set 1 (Introduction) In this post, Game of Nim is discussed. The Game of Nim is described by the following rules- “ Given a number of piles in which each pile contains some numbers of stones/coins. In each turn, a player can choose only one pile and 15+ min read Game Theory (Normal-form Game) | Set 4 (Dominance Property-Pure Strategy) In some of the games, it is possible to reduce the size of the payoff matrix by eliminating rows (or columns) that are dominated by other rows (or columns) respectively.Dominance property for rows: X ≤ Y i.e. if all the elements of a particular row X are less than or equal to the corresponding elements of another row Y then delete row X (row X is 4 min read Winning Game by replacing numbers with factors (Brain Game) Given 2 players A and B take turns alternatively to play a game in which they have N numbers on a paper. In one turn, a player can replace one of the numbers by any of its factors (except for 1 & the number itself). The player who is unable to make a move loses the game. Find the winner of the game if A starts the game and both play optimally. 15+ min read Game of Chocolates | Wythoff's Game Bunty and Dolly are playing a game, described as follows:There are two boxes having A and B number of chocolates respectively. Both can eat L (L >= 1) chocolates from any one box or L chocolates from both boxes in one move. They play the game alternatively and the last one to eat the chocolate will be the winner. You have to help Bunty in decidi 13 min read 3 Sum - Find All Triplets with Zero Sum Given an array of distinct elements. The task is to find triplets in the array whose sum is zero. Examples : Input: arr[] = {0, -1, 2, -3, 1}Output: [[0, -1, 1], [2, -3, 1]]Explanation: The triplets with zero sum are 0 + -1 + 1 = 0 and 2 + -3 + 1 = 0 Input: arr[] = {1, -2, 1, 0, 5}Output: [[1, -2, 1]]Explanation: The triplets with zero sum is 1 + - 15+ min read Different ways to represent N as sum of K non-zero integers Given N and K. The task is to find out how many different ways there are to represent N as the sum of K non-zero integers. Examples: Input: N = 5, K = 3 Output: 6 The possible combinations of integers are: ( 1, 1, 3 ) ( 1, 3, 1 ) ( 3, 1, 1 ) ( 1, 2, 2 ) ( 2, 2, 1 ) ( 2, 1, 2 ) Input: N = 10, K = 4 Output: 84 The approach to the problem is to observ 8 min read Longest Subarray with Sum greater than Equal to Zero Given an array of N integers. The task is to find the maximum length subarray such that the sum of all its elements is greater than or equal to 0. Examples: Input: arr[]= {-1, 4, -2, -5, 6, -8} Output: 5 Explanation: {-1, 4, -2, -5, 6} forms the longest subarray with sum=2. Input: arr[]={-5, -6} Output: 0 Explanation: No such subarray is possible A 12 min read Count of numbers between range having only non-zero digits whose sum of digits is N and number is divisible by M Given a range [L, R] and two positive integers N and M. The task is to count the numbers in the range containing only non-zero digits whose sum of digits is equal to N and the number is divisible by M.Examples: Input: L = 1, R = 100, N = 8, M = 2 Output: 4 Only 8, 26, 44 and 62 are valid numbers Input: L = 1, R = 200, N = 4, M = 11 Output: 2 Only 2 14 min read Number of subsequences with zero sum Given an array arr[] of N integers. The task is to count the number of sub-sequences whose sum is 0. Examples: Input: arr[] = {-1, 2, -2, 1} Output: 3 All possible sub-sequences are {-1, 1}, {2, -2} and {-1, 2, -2, 1} Input: arr[] = {-2, -4, -1, 6, -2} Output: 2 Approach: The problem can be solved using recursion. Recursively, we start from the fir 6 min read Subset with sum closest to zero Given an array 'arr' consisting of integers, the task is to find the non-empty subset such that its sum is closest to zero i.e. absolute difference between zero and the sum is minimum.Examples: Input : arr[] = {2, 2, 2, -4} Output : 0 arr[0] + arr[1] + arr[3] = 0 That's why answer is zero.Input : arr[] = {1, 1, 1, 1} Output : 1 One simple approach 8 min read Minimum steps to make sum and the product of all elements of array non-zero Given an array arr of N integers, the task is to find the minimum steps in which the sum and product of all elements of the array can be made non-zero. In one step any element of the array can be incremented by 1.Examples: Input: N = 4, arr[] = {0, 1, 2, 3} Output: 1 Explanation: As product of all elements of the array is zero Increment the array e 7 min read Count numbers with exactly K non-zero digits and distinct odd digit sum Given an Integer N, and a number K, the task is to find out the total numbers from 0 to N which have exactly K non zero digits and the sum of those digits should be odd and that sum should be distinct. The number N can be as large as 10^18.Examples: Input : N = 10, K = 1 Output : 5 The numbers which follow the conditions are -> 1, 3, 5, 7 and 9 14 min read Count subarrays with non-zero sum in the given Array Given an array arr[] of size N, the task is to count the total number of subarrays for the given array arr[] which have a non-zero-sum.Examples: Input: arr[] = {-2, 2, -3} Output: 4 Explanation: The subarrays with non zero sum are: [-2], [2], [2, -3], [-3]. All possible subarray of the given input array are [-2], [2], [-3], [2, -2], [2, -3], [-2, 2 7 min read Find N distinct integers with zero sum Given an integer N, our task is to print N distinct numbers such that their sum is 0.Examples: Input: N = 3 Output: 1, -1, 0 Explanation: On adding the numbers that is 1 + (-1) + 0 the sum is 0.Input: N = 4 Output: 1, -1, 2, -2 Explanation: On adding the numbers that is 1 + (-1) + 2 + (-2) the sum is 0. Approach: To solve the problem mentioned abov 4 min read Check if sum of array can be reduced to zero by repetitively reducing array element by their index value Given an array arr[] consisting of N integers, the task is to determine if the sum of array elements can be reduced to 0 by performing the following operations any number of times: Choose an element A[i] and reduce A[i] by i(1-based indexing), any number of times, possibly 0.If the sum can be reduced to 0, print "Yes". Otherwise, print "No". Exampl 5 min read Queries to minimize sum added to given ranges in an array to make their Bitwise AND non-zero Given an array arr[] consisting of N integers an array Q[][] consisting of queries of the form {l, r}. For each query {l, r}, the task is to determine the minimum sum of all values that must be added to each array element in that range such that the Bitwise AND of all numbers in that range exceeds 0. Note: Different values can be added to different 10 min read Rearrange array to make product of prefix sum array non zero Given an array, arr[ ] of size N, the task is to rearrange the given array such that the product of all the elements of its prefix sum array is not equal to 0. If it is not possible to rearrange the array that satisfies the given condition, then print -1. Examples: Input: arr[] = {1, -1, -2, 3}Output: 3 1 -1 -2Explanation:Prefix sum after rearrangi 7 min read Rearrange array to make sum of all subarrays starting from first index non-zero Given an array arr[] consisting of N integers, the task is to rearrange the array such that sum of all subarrays starting from the first index of the array is non-zero. If it is not possible to generate such arrangement, then print "-1". Examples: Input: arr[] = {-1, 1, -2, 3}Output: {-1, -2, 1, 3}Explanation: One of the possible rearrangement is { 12 min read Minimize increments or decrements required to make sum and product of array elements non-zero Given an array arr[] of N integers, the task is to count the minimum number of increment or decrement operations required on the array such that the sum and product of all the elements of the array arr[] are non-zero. Examples: Input: arr[] = {-1, -1, 0, 0}Output: 2Explanation: Perform the following operations to update the array as:Operation 1: In 6 min read Construct array with sum of product of same indexed elements in the given array equal to zero Given an array, arr[] of size N (always even), the task is to construct a new array consisting of N non-zero integers such that the sum of the product of the same indexed elements of arr[] and the new array is equal to 0. If multiple solutions exist, print any one of them. Examples: Input: arr[] = {1, 2, 3, 4}Output: -4 -3 2 1 Explanation: Sum of p 6 min read Minimize rows to be made zero for last column sum to be at most any one column Given an N * M matrix mat[][] consisting of non-negative integers. In one operation, select any row and change all elements to 0. The task is to find the minimum number of operations required such that the sum of elements in the Mth column is less than or equal to the sum of elements in jth column for at least one 'j' ( where 1 ≤ 'j' ≤ 'M'-1). Exam 15+ min read Maximum sum of a subsequence whose Bitwise AND is non-zero Given an array arr[] consisting of N integers, the task is to find the maximum sum of any subsequence from the array having Bitwise AND of its elements not equal to zero. Examples: Input: arr[] = {5, 4, 1, 7, 11}Output: 24Explanation: Subsequence with maximum sum is the entire array. Bitwise AND of the array is 0. Hence, the subsequence cannot be c 6 min read

    Article Tags :

    • DSA
    • Game Theory
    • Mathematical
    • Technical Scripter

    Practice Tags :

    • Game Theory
    • Mathematical

    Trending in News

    View More
    • How to Delete Discord Servers: Step by Step Guide
    • Google increases YouTube Premium price in India: Check our the latest plans
    • California Lawmakers Pass Bill to Limit AI Replicas
    • Best 10 IPTV Service Providers in Germany
    • 15 Most Important Aptitude Topics For Placements [2024]

    We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy

    Zero-Sum Game - GeeksforGeeks (4)

    Zero-Sum Game - GeeksforGeeks (2024)
    Top Articles
    Latest Posts
    Article information

    Author: Edwin Metz

    Last Updated:

    Views: 5461

    Rating: 4.8 / 5 (78 voted)

    Reviews: 85% of readers found this page helpful

    Author information

    Name: Edwin Metz

    Birthday: 1997-04-16

    Address: 51593 Leanne Light, Kuphalmouth, DE 50012-5183

    Phone: +639107620957

    Job: Corporate Banking Technician

    Hobby: Reading, scrapbook, role-playing games, Fishing, Fishing, Scuba diving, Beekeeping

    Introduction: My name is Edwin Metz, I am a fair, energetic, helpful, brave, outstanding, nice, helpful person who loves writing and wants to share my knowledge and understanding with you.