Set .add()

Task Apply your knowledge of the .add() operation to help your friend Rupal. Rupal has a huge collection of country stamps. She decided to count the total number of distinct country stamps in her collection. She asked for your help. You pick the stamps one by one from a stack of N country stamps. Find … Continue reading Set .add()

Find the Second Largest Number

You are given N numbers. Store them in a list and find the second largest number. Input Format The first line contains N. The second line contains an array A[] of N integers each separated by a space.     if __name__ == '__main__': n = int(input()) arr = map(int, input().split()) print(sorted(list(set(arr)))[-2])

Mini-Max Sum

Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers. Then print the respective minimum and maximum values as a single line of two space-separated long integers. import*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static … Continue reading Mini-Max Sum


Alice wrote a sequence of words in CamelCase as a string of letters,s , having the following properties: 1. It is a concatenation of one or more words consisting of English letters. 2. All letters in the first word are lowercase. 3. For each of the subsequent words, the first letter is uppercase and rest … Continue reading CamelCase