Roy wants to change his profile picture on Facebook. Now Facebook has some restriction over the dimension of Roy’s Picture that we can upload. It is a problem of . Minimum dimension of the picture can be L x L, WHERE L is the length of the side of square. Now Roy has N photos of various dimensions. Dimension of a photo is denoted as W x H where W – width of the photo AND H – Height of the …

Home » Programming » C

# Category: C

→

The Code in C

You have been given a String S consisting of uppercase and lowercase English alphabets. You need to change the case of each alphabet in this String. That is, all the uppercase letters should be converted to lowercase and all the lowercase letters should be converted to uppercase. That is Toggle String. You need to then print the resultant String to output. Input Format Of Toggle String The first and only line of input contains the String S Output Format Print …

Alexa has two stacks of non-negative integers, stack A=[a0,a1,…….am-1] and stack B=[b0,b1,…………bn-1] where index 0 denotes the top of the stack. Alexa challenges Nick to play the following game Game of Two Stacks Hackerrank : In each move, Nick can remove one integer from the top of either stack A or stack B. Nick keeps a running sum of the integers he removes from the two stacks. Nick is disqualified from the game if, at any point, his running sum becomes greater than some integer x given at the beginning …

Hi if you are computer science student you should Learn C at first. Learn C – The first program for Beginner : Here we write first code in C language. for any program, we need some library so we use #include this library is used for all functions like scanf() and printf(). main() is the function which must be in the every program. so here we begin with c. #include <stdio.h> int main(){ // this is a comment , in …

Given N integers, count the number of pairs of integers whose difference is K. Input Format The first line contains N and K. The second line contains N numbers of the set. All the N numbers are unique. Constraints 2<=N<=105 0<=K<=109 Each integer will be greater than 0 and at least K smaller than 231-1. Output Format An integer that tells the number of pairs of integers whose difference is K. <strong>Sample Input</strong> 5 2 1 5 3 4 2 …

Time Conversion Given a time in 12-hour AM/PM format, convert it to military (24-hour) time. Note: Midnight is 12:00:00AM on a 12-hour clock, and 00:00:00 on a 24-hour clock. Noon is 12:00:00PM on a 12-hour clock, and 12:00:00 on a 24-hour clock. Input Format A single string containing a time in 12-hour clock format (i.e.: hh:mm:ssAM or hh:mm:ssPM), where 01

Solve Me First The purpose of this challenge is to familiarize you with reading input from stdin (the standard input stream) and writing output to stdout (the standard output stream) using our environment. Review the code provided in the editor below, then complete the solveMeFirst function so that it returns the sum of two integers read from stdin. Take some time to understand this code so you’re prepared to write it yourself in future challenges. Select a language below, and …