Integer concatenation solution codechef

Integer concatenation solution codechef Concatenation of two integers is obtained as follows: First, convert both integers to strings. Then concatenate both strings into one and convert this concatenated string back to integer. For example, concatenation of 66 and 77 is CONC(6,7)=67CONC(6,7)=67, concatenation of 123123 and 4545 is CONC(123,45)=12345CONC(123,45)=12345. Integer concatenation Continue reading Integer concatenation solution codechef

Minimise the Size solution codechef

Minimise the Size solution codechef Consider an array A={a1,a2,…,an}A={a1,a2,…,an} of size n≥1n≥1. If ak=2x−1ak=2x−1 for all 1≤k≤n1≤k≤n, for some integer xx (1≤x≤60)(1≤x≤60), then AA is called interestinginteresting arrayarray. Minimise the Size solution codechef You are given a number CC. Find any interestinginteresting arrayarray AA of minimum possible size such that a1⨁a2⨁…⨁an=Ca1⨁a2⨁…⨁an=C, where ⨁⨁ represents bitwise XOR operation. If there exists Continue reading Minimise the Size solution codechef

Division solution codechef – Chef has an integer NN. He repeats the following operation until NN becomes 11.

Division solution codechef – Chef has an integer NN. He repeats the following operation until NN becomes 11. Chef has an integer NN. He repeats the following operation until NN becomes 11. Chef chooses an integer XX such that X>1X>1 and XX is a divisor of NN and then divides NN by XX (the new value of NN becomes N/XN/X). If XX is even, Chef Continue reading Division solution codechef – Chef has an integer NN. He repeats the following operation until NN becomes 11.

Nice Pairs solution codechef

Nice Pairs solution codechef Given a string SS of length NN containing only numeric characters, find the number of Nice Pairs. A Nice Pair is a pair of indices – (i,j)(i,j) such that 1≤i<j≤N1≤i<j≤N and j−i=|Sj−Si|j−i=|Sj−Si|. Input Format Nice Pairs solution codechef First line will contain TT, number of testcases. Then the testcases Continue reading Nice Pairs solution codechef

Make Them Equal solution codeforces

Make Them Equal solution codeforces The of anis has a string s1s2…sns1s2…sn and a character cc. He wants to make all characters of the string equal to cc using the minimum number of operations. In one operation he can choose a number xx (1≤x≤n1≤x≤n) and for every Continue reading Make Them Equal solution codeforces