Knowee
Questions
Features
Study Tools

Given a number N, find the least palindromic number K, such that K>N.Input FormatThe first line of input contains T - the number of test cases. It's followed by T lines, each containing a single number N.Output FormatPrint the least palindromic number K for each test case, such as K>N, separated by a new line.Constraints30 points1 <= T <= 1041 <= N <= 10470 points1 <= T <= 1051 <= N <= 109ExampleInput211121Output22131

Question

Given a number N, find the least palindromic number K, such that K>N.Input FormatThe first line of input contains T - the number of test cases. It's followed by T lines, each containing a single number N.Output FormatPrint the least palindromic number K for each test case, such as K>N, separated by a new line.Constraints30 points1 <= T <= 1041 <= N <= 10470 points1 <= T <= 1051 <= N <= 109ExampleInput211121Output22131

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

This problem is about finding the smallest palindromic number that is greater than a given number. A palindromic number is a number that remains the same when its digits are reversed.

Similar Questions

A positive integer is called a palindrome if its representation in the decimal system is the same when read from left to right and from right to left. For a given positive integer K of not more than 1000000 digits, write the value of the smallest palindrome larger than K to output. Numbers are always displayed without leading zeros.InputThe first line contains integer t, the number of test cases. Followed by t lines containing integers K.OutputFor each K, output the smallest palindrome larger than K.ExampleInput:28082133Output:8182222Warning: large Input/Output data, be careful with certain languages

Input FormatThe first line of input contains T - the number of test cases. It's followed by T lines, each line contains 2 numbers N and P, separated by space.Output FormatFor each test case, print the value of N % P, separated by a new line.Constraints20 points1 <= T <= 1001 <= N <= 10181 <= P <= 10880 points1 <= T <= 1001 <= N <= 10100001 <= P <= 1015ExampleInput45 24 101085377843 817659438290826691135830692772803 95972011Output142242058460316167

Write a programme to check whether given input is palindrome or notConstraintsABC != PalindromeMAM == Palindrome123 != Palindrome151 == Palindrome

Your friend is in university and there is a coding challenge going on. A string S of lowercase letters is displayed over the screen. The length of the string is N. An integer M is also displayed over the screen.Your task is write a program to determine if we can make the string Palindrome by performing at most M operations on the provided string

Understand the problem statement from the given sample input and output.Input FormatThe first line of input contains T - the number of test cases. It's followed by T lines, each line contains 2 strings A and B, separated by space, consisting only of lowercase English alphabets.Output FormatFor each test case, print the desired output, separated by a new line.Constraints10 points1 <= T <= 1001 <= len(A), len(B) <= 10040 points1 <= T <= 10001 <= len(A) <= 50001 <= len(A), len(B) <= 5000ExampleInput2data structuressmart interviewsOutputsrucuresineview

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.