title-img


Lower Bound-STL C++

You are given N integers in sorted order. Also, you are given Q queries. In each query, you will be given an integer and you have to tell whether that integer is present in the array. If so, you have to tell at which index it is present and if it is not present, you have to tell the index at which the smallest integer that is just greater than the given number is present. Lower bound is a function that can be used with a sorted vector. Input Format The first line of the input contains

View Solution →

Sets-STL C++

Sets are a part of the C++ STL. Sets are containers that store unique elements following a specific order. Here are some of the frequently used member functions of sets: Declaration: set<int>s; //Creates a set of integers. Size: int length=s.size(); //Gives the size of the set. Insert: s.insert(x); //Inserts an integer x into the set s. Erasing an element: s.erase(val); //Erases an integer val from the set s. Finding an element:

View Solution →

Maps-STL C++

Maps are a part of the C++ STL.Maps are associative containers that store elements formed by a combination of a key value and a mapped value, following a specific order.The mainly used member functions of maps are: Map Template: std::map <key_type, data_type> Declaration: map<string,int>m; //Creates a map m where key_type is of type string and data_type is of type int. Size: int length=m.size(); //Gives the size of the map. Insert: m.insert

View Solution →

Print Pretty C++

Given a text file with many lines of numbers to format and print, for each row of 3 space-separated doubles, format and print the numbers using the specifications in the Output Format section below. Input Format The first line contains an integer, T , the number of test cases. Each of the T subsequent lines describes a test case as 3 space-separated floating-point numbers: A , B and C, respectively. Constraints 1 <= T <= 1000 Each number will fit into a double. Output Format

View Solution →

What's Your Name? Python

You are given the firstname and lastname of a person on two different lines. Your task is to read them and print the following: Hello firstname lastname! You just delved into python. Input Format: The first line contains the first name, and the second line contains the last name. Constraints: The length of the first and last name ≤ 10. Output Format: Print the output as mentioned above.

View Solution →