Category Archives: Algorithm

Pizza cut problem (Or Circle Division by Lines)

Given number of cuts, find the maximum number of possible pieces. Examples: Input : 2 Output : 4 Input : 3 Output : 7 This problem is nothing but The Lazy Caterer’s Problem and has below formula. Maximum number of pieces = 1 + n*(n+1)/2 Refer this for proof. Output: 7 This article is contributed… Read More »

Gold Mine Problem

Given a gold mine of n*m dimensions. Each field in this mine contains a positive integer which is the amount of gold in tons. Initially the miner is at first column but can be at any row. He can move only (right->,right up /,right down\) that is from a given cell, the miner can move… Read More »