Français
Ouvrir dans Telegram

Message Jack is a programmer who is working on a new feature for his company's website. The feature involves displaying a list o…

30 juin 2023
A
Jack is a programmer who is working on a new feature for his company's website. The feature involves displaying a list of products with their corresponding prices in an array on the website. One day, Jack noticed that the array of prices was printed on the website as a string (size N) of digits without any spaces. Jack needs to retrieve the original array from the printed string, but he only knows that all integers in the array were in the range [1, K] and there were no leading zeros in the array. To retrieve the original array, Jack needs to figure out all the possible arrays that could have been printed as the given string S. He wants to automate this process, and so he needs to write a program that can calculate the number of possible arrays based on the given string and the range K. Example 1: If the given string is "123" and K is 3, there is a single possible array: [1, 2, 3]. Note that [2, 3, 1] is not a valid array because the integers are out of order. Example 2: If the given string is "123" and K is 1000, there are four possible arrays: [1, 2, 3], [12, 3], [1, 23], [123] Since, the number of possible arrays may be very large, Jack needs to return the answer modulo 10^9 + 7. Can you help Jack by writing a program to calculate the number of possible arrays? Input Format The first line of the input contains two space-separated integers, N and K. The second line of the input contains a string S, consisting of only digits (0-9) and does not contain leading zeros. Constraints 1 <= N <= 10^5 1 <= K <= 10^9 Output Format A single positive integer representing the number of possible arrays. Sample TestCase 1 Input 3 3 123 Output 1 Explanation As explained in the example. Sample TestCase 2 Input 3 1000 123 Output 4

À proximité dans le fil

RRahul🥳 Offer - Offer - Offer 🥳 👉 Trendy Tech Azure Data Engineering & Big Data Course 👈 ❤️‍🔥 Combo(Both) Price : 1.5k Only/- ❤️‍🔥 Single Price: 1k Only/- DM Fast NowRRahulNew Offer 🥳 New Offer 🥳 ⏳⚠️ Special Offer ⚠️⏳ All courses available in ❤‍🔥 200rs ❤‍🔥 Only /- ❤‍🔥 200rs ❤‍🔥 ❤‍🔥 200rs ❤‍🔥 ❤‍🔥 200rs ❤‍🔥❤‍🔥 200rs ❤‍🔥 ❤‍🔥 200rs ❤‍
ce message
AAbhinav KumarAnyone solve this problem and send me any languagePPrabhleen SharmaUnlock the Power of Python: Learn to Code Like a Pro and Build Your Dream Projects Today! Date: 11july 2023 Day: Tuesday Introduction & Overview Session Python
CCore Java | Java for BeginnersCore Java | Java for Beginners@codeitupjava · groupe · Technologie
1 312membres62écrivent en 30 jours
Fil de la communauté Ouvrir dans Telegram

Un fil public ouvert issu de l'index de recherche ChatCrawler — « le Google du Telegram public » ; actualisé à mesure que la communauté est explorée. Les heures sont en UTC.

Contenu public uniquement, API officielle de Telegram. À propos · FAQ · Limites de l'index · Retirer une page · Catalogue · Recherche · Comment nous comptons