Question
QUESTION 1:Language is Python 3 Given an integer X, write and algorithm to find the number of integers which are less than or equal to
QUESTION 1:Language is Python 3 Given an integer X, write and algorithm to find the number of integers which are less than or equal to X and those whose digits add up to Y. Input: The first line of input consists of an integer-inputNum1, representing the given number X. The next line consists of an integer-inputNum2, representing the given number Y. Output: Print the count of numbers whose digits add up to Y for the given number X. Note If no numbers are found whose digits add up to Y for the given number X, then print -1. Example: input: 20 5 output: 2 Explanation: x is 20 and Y is 5. There are only 2 integers <= 20, i.e., 5 and 14 whose digits add up to 5. So the output is 2. Beginning Code: using System; QUESTION 2: Ray,Shiv, and Ansh are conducting a survey for a group of people. The survey for a group of people. The survey is only meant for twins but there are certain people who are not twins and wanting to take part in the survey. Write an algorithm to help them identify the person from the given input who is not a twin. Input The first line of input consists of an integer- inputArr_size, representing the number of entries in the array(N). The next line consists of N space-separated integer elements in the array. Output Print the smallest value of the person who is not a twin from the given array of elements. Note If everyone present is a twin, then return -1. Example: Input: 7 1 1 2 3 3 4 4 Output: 2 since it's the only none twin element Question 3: You are given a list of strings that may represent valid latitude/longitude pairs. Your task is to check if the given latitude/longitude pairs are valid or not. A string (X,Y) is considered valid if the following criteria are met: The string starts with a bracket,has a comma after X and ends with a bracket. There is no space between the opening parenthesis and the first character of X. There is no space between the comma and the last character of X There is no space between the comma and the first character of Y There is no space between Y and the closing parenthesis. Xand Y are decimal numbers and may be preceded by a sign. There is no leading 0's. No other characters are allowed in X or Y. -90< OR EQUAL TO X < or equal to 90 and -180 < or equal to Y
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started