Question: program I java program in java Geek has a string s. He creates a new string s1 by concatenating string s with itself. He then

program I java

program I java program in java Geek has a string s. He

creates a new string s1 by concatenating string s with itself. He

then rotates s1 to the left an arbitrary number of times. For

Example: Rotating "abc" to the left gives "bca". You are given string

S1, find if it was created by Geek (using the above operations

program in java

Geek has a string s. He creates a new string s1 by concatenating string s with itself. He then rotates s1 to the left an arbitrary number of times. For Example: Rotating "abc" to the left gives "bca". You are given string S1, find if it was created by Geek (using the above operations on s) or not. Return 1 or 0 based on your answer. Example 1: Input : s1= "abcabc" Output : 1 Explanation: s1= "abcabc" can be generated by s= "abc". In the new year, Geek has decided to go on a road trip in GeekLand with his family. GeekLand has n cities that are connected by (n1) bidirectional roads. Each road in GeekLand is represented by [a,b, type]. This means that city a and b are connected by a road of 'type'. When type =0 it represents a normal road and when type =1 it represents a highway. Geek considers a trip to be good if it includes - traveling via a highway at least once - stopping at exactly K cities along the way Count the number of good trips possible. Since the answer can be large, return it modulo 109+7 Note that the stops need not be distinct (see the example for better understanding). Example 1: Geek's New Year Trip Accuracy: 50.0% Submissions: 4 Points: 45 Lount the number of good trips possible. SInce the answer can be large, return it modulo 109+7 Note that the stops need not be distinct (see the example for better understanding). Example 1: Input: n=3 k=2 roads = [ [1,2,1] [2,3,0] [] Output: 4 Explanation: Possible good trips are - [1,2] : start at 1 , stop at 2 . [1,3]; start at 1, don't stop at 2 , go directly to 3 . [2,1] : stant at 2 , stop at 1 . [3,1] : stort at 3, don't stop at 2, go directly to 1. Example 2: Input: n=5k=3 Geek's New Year Trip Accuracy: 50.0% Submissions: 4 Poiniss 45

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!