Tag Archives: codechef

CodeChef : February Challenge 2018 – Chef And The Patents

Chef And The Patents Source: CodeChef Chef has decided to start a new firm called PatentChef. However, he’s stuck with some big legal issues. Their firm has received offers from a lot of companies, so Chef told his friend Junior Chef to look over some patent cases and solve them as quickly as he can. Junior Chef is… Read More »

CodeChef : February Challenge 2018 – Chef And His Characters

Chef And His Characters Source: CodeChef Chef was reading a book. He decided to highlight all the lovely sentences of the book. He calls a sentence a lovely sentence if, after removing all the non-alphabetical characters (like punctuation and spaces) from it and converting all uppercase letters to lowercase, it is possible to choose four contiguous characters from the sentence and reorder… Read More »

CodeChef : January Challenge 2018 – K-Concatenation

K-Concatenation Source: CodeChef You are given an array A with size N (indexed from 0) and an integer K. Let’s define another array B with size N · K as the array that’s formed by concatenating K copies of array A. For example, if A = {1, 2} and K = 3, then B = {1, 2, 1, 2, 1, 2}. You have to find the maximum subarray sum of the array B. Fomally, you should compute the maximum… Read More »

CodeChef : January Challenge 2018 – Maximum Score

Maximum Score Source: CodeChef You are given N integer sequences A1, A2, …, AN. Each of these sequences contains Nelements. You should pick N elements, each from one sequence; let’s denote the element picked from sequence Ai by Ei. For each i (2 ≤ i ≤ N), Ei should be strictly greater than Ei-1. Compute the maximum possible value of E1 + E2 + … + EN. If it’s impossible to pick the elements E1, E2, …, EN, print… Read More »

CodeChef : January Challenge 2018 – Rectangle

Rectangle Source: CodeChef You are given four integers a, b, c and d. Determine if there’s a rectangle such that the lengths of its sides are a, b, c and d (in any order). Input The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows. The first and only line of each test case contains four space-separated integers a, b, c and d. Output… Read More »