CodeVita 2017 Round-1 Problem-B
Problem : Concatenating primes
If you like numbers, you may have been fascinated by prime numbers. Sometimes we obtain by concatenating two primes. For
example, concatenating 2 and 3, we obtain the prime 23. The aim is to find all such distinct “concatenated primes” that could
be obtained by concatenating primes ≤ a given integer N.
Input Format:
Integer N
Output Format:
M, the number of distinct primes that could be obtained by concatenating two primes ≤ N
TCS-Codevita 2017 Round-1 Problem-A
**Problem : **Mountain peak sequence
Consider the first three natural numbers 1, 2, 3. These can be arranged in the following ways: 2, 3, 1 and 1, 3, 2. Inboth of
these arrangements, the numbers increase to a certain point and then decrease. A sequence with this property is called a
“mountain peak sequence”.
Given an integer N, write a program to find the remainder of mountain peak arrangements that can be obtained by rearranging
Codechef SEPT17 CookOff - Subsequence Equality Problem Code: LIKECS01
Problem: (Link: https://www.codechef.com/problems/LIKECS01 ) Chef Tobby is playing a rapid fire with Bhuvan. He gives Bhuvan a string S and each time, Bhuvan has to guess whether there exists 2 equal subsequences in the string or not.
Bhuvan got a perfect score in the game with Chef Tobby. However, Chef Tobby has now asked Bhuvan to write a program that will do this automatically given a string S. Bhuvan is an intelligent man but he does not know how to write a code.
Codechef - Courses in an university - Problem Code: UNICOURS
Problem There are n courses in a university being offered. These courses are numbered from 1 to n in the increasing order of their difficulty. For each course, you can have some courses as prerequisites. The prerequisite courses for a course should be of lower difficulty than it. You are given an array a of size n, where ai denotes that there should be at least ai prerequisite courses for i-th course.
Codechef MAY17 chef and his daily routine ( code: CHEFROUT )
Problem : https://www.codechef.com/problems/CHEFROUT Chef’s daily routine is very simple. He starts his day with cooking food, then he eats the food and finally proceeds for sleeping thus ending his day. Chef carries a robot as his personal assistant whose job is to log the activities of Chef at various instants during the day. Today it recorded activities that Chef was doing at N different instants. These instances are recorded in chronological order (in increasing order of time).
ProjectEuler -01 Multiple of 3 and 5
PROBLEM : https://www.hackerrank.com/contests/projecteuler/challenges/euler001
If we list all the natural numbers below that are multiples of or , we get and . The sum of these multiples is .
Find the sum of all the multiples of or below .
Input Format
First line contains that denotes the number of test cases. This is followed by lines, each containing an integer, .
Constraints
Output Format
CodeChef SEPT17 Sereja and Commands (code: SEACO)
Problem: Little Chef and Sum
https://www.codechef.com/SEPT17/problems/SEACO
Sereja has an array A consisting of n integers. Initially, all the elements of array are zero.
Sereja writes down m commands on a piece of a paper. The commands are enumerated from 1 to m. These commands can be of the following two types of commands:
l r (l ≤ l ≤ r ≤ n) — Increase all elements of the array by one, whose indices belongs to the range [l, r] l r (1 ≤ l ≤ r ≤ m) — Execute all the commands whose indices are in the range [l, r].
CodeChef SEPT17 Chef and Pick Digit (code: CHEFPDIG)
Problem: Little Chef and Sum
https://www.codechef.com/SEPT17/problems/CHEFPDIG
Chef likes to play with big numbers. Today, he has a big positive integer N. He can select any two digits from this number (the digits can be same but their positions should be different) and orders them in any one of the two possible ways. For each of these ways, he creates a two digit number from it (might contain leading zeros). Then, he will pick a character corresponding to the ASCII value equal to this number, i.
CodeChef SEPT17 Little Chef and Sum ( code: CHEFSUM)
Problem: Little Chef and Sum
https://www.codechef.com/SEPT17/problems/CHEFSUM
Our little chef is fond of doing additions/sums in his free time. Today, he has an array A consisting of N positive integers and he will compute prefix and suffix sums over this array.
He first defines two functions prefixSum(i) and suffixSum(i) for the array as follows. The function prefixSum(i) denotes the sum of first i numbers of the array. Similarly, he defines suffixSum(i) as the sum of last N - i + 1 numbers of the array.
CodeChef SEPT17 Problem: MINPERM
Problem:Minimum Good Permutation
A permutation of length n is an array of size n consisting of n distinct integers in the range [1, n]. For example, (3, 2, 4, 1) is a permutation of length 4, but (3, 3, 1, 4) and (2, 3, 4, 5) are not, as (3, 3, 1, 4) contains duplicate elements, and (2, 3, 4, 5) contains elements not in range [1,4].
A permutation p of length n is good if and only if for any 1 ≤ i ≤ n, pi ≠ i.
CodeChef SEPT17 Problem: CHEFSUM
Problem: Little Chef and Sums
Our little chef is fond of doing additions/sums in his free time. Today, he has an array A consisting of N positive integers and he will compute prefix and suffix sums over this array.
He first defines two functions prefixSum(i) and suffixSum(i) for the array as follows. The function prefixSum(i) denotes the sum of first i numbers of the array. Similarly, he defines suffixSum(i) as the sum of last N - i + 1 numbers of the array.
CodeChef (AUG17 LunchTime) : Mathison and pangrams - MATPAN
Problem: Mathison and pangrams
Mathison recently inherited an ancient papyrus that contained some text. Unfortunately, the text was not a pangram. Now, Mathison has a particular liking for holoalphabetic strings and the text bothers him. The good news is that Mathison can buy letters from the local store in order to turn his text into a pangram.
However, each letter has a price and Mathison is not very rich. Can you help Mathison find the cheapest way to obtain a pangram?
HackerRank - 101 Hack 51 - Fair Cake Cutting
Problem: Fair Cake Cutting
Leha is a young man from Belarus. He loves cakes really much. In Leha’s country, cakes are always evenly divided between people.
Leha wants to know how many people he should invite to his party if he has a cake whose size is equal to units and he wants each person to get exactly units of cake. Note that Leha doesn’t take a piece for himself; in other words, the cake is only divided among the people he invited to the party.
TCS Code Vita 6 ( problem-B )
Problem : Concatenating primes
If you like numbers, you may have been fascinated by prime numbers. Sometimes we obtain by concatenating two primes. For example, concatenating 2 and 3, we obtain the prime 23. The aim is to find all such distinct “concatenated primes” that could be obtained by concatenating primes ≤ a given integer N.
**
Input Format:**
Integer N
Output Format:
M, the number of distinct primes that could be obtained by concatenating two primes ≤ N