IN JAVA
(Maximum consecutive increasingly ordered sub-string)
Write a program that prompts the user to enter a string and displays the maximum consecutive increasingly ordered sub-string.
Analyze the time complexity of your program and explain.
Here is a sample run:
Enter a string: abcabcdgabxy
output
abcdg
Time complexity is O( ). -n must be display between the parenthesis.
`Hey,
Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries
import java.util.*;
public class TEST {
public static void main(String[] args) {
// Create a Scanner
Scanner input = new
Scanner(System.in);
LinkedList<Character> max =
new LinkedList<>();
LinkedList<Character> list =
new LinkedList<>();
// Prompt the user to enter
a string
System.out.print("Enter a string:
");
String string =
input.nextLine();
// Find the maximum
consecutive increasingly ordered substring
for (int i = 0; i <
string.length(); i++) { // single
loop
if (list.size()
> 1 && string.charAt(i) <= list.getLast()
&&
list.contains(string.charAt(i))) {
list.clear(); // Simple statement
}
list.add(string.charAt(i)); // Simple statement
if
(list.size() > max.size()) { // Simple statement
max.clear();
max.addAll(list);
}
}
// Display the maximum
consecutive
// increasingly ordered
substring
for (Character ch: max) { // single
loop
System.out.print(ch); // Simple statement
}
System.out.println();
}
}

Time complexity is O(n) since it is traversing whole string constant times.
Kindly revert for any queries
Thanks.
IN JAVA (Maximum consecutive increasingly ordered sub-string) Write a program that prompts the user to enter...
Please answer in Python 3! 16.2** (Maximum increasingly ordered subsequence) Write a program that prompts the user to enter a string and displays the maximum increasingly ordered subsequence of characters. Analyze the time complexity of your program. Here is a sample run: Enter a string: Welcome Maximum consecutive substring is ['W', 'e', 'l', 'o']
JAVA Write a program that prompts the user to enter a year and the first three letters of a month name (with the first letter in uppercase) and displays the number of days in the month. If the input for month is incorrect, display a message as shown in the following sample run. SAMPLE RUN 1: Enter a year: 2001 Enter a month: Jan Jan 2001 has 31 days SAMPLE RUN 2: Enter a year: 2016 Enter a month: Feb...
1. Backward String Design a program that prompts the user to enter a string and then displays the string contents backward. For instance, if the user enters “gravity” the program should display “ytivar" -VB or Visual Studio. It must be turned into a GUI program. Make sure to write comments and include pseudocode. -Paste a screenshot of the pseudocode, the VB code, and of the program running into a PDF.
Write a program that prompts the user to enter a binary string and displays the corresponding decimal integer value. For example, binary string ‘10001’ is 17 (1*24 +0*23 +0*22 +0*2 + 1 = 17) A sample run : Enter a binary: 10001 17 Enter second integer: 110 6 Use python.
write a java program that displays the following:
Write a Java program that prompts the user to enter an integer and determines whether 1. it is divisible by 5 and 6, whether on 2. it is divisible by 5 or 6, 3. it is divisible by 5 or 6, but not both. Here is a sample run of this program: Sample run: Enter an integer: 10 Is 10 divisible by 5 and 6? false Is 10 divisible by 5 or...
Program must be in Python 3.
Write a program that prompts the user to enter two strings and then displays a message indicating whether or not the first string starts with the second string. Your program must satisfy the following requirements. 1. Your program must include a function called myStartsWith that takes two string parameters. This function returns True if the rst string starts with the second string and returns False otherwise. 2. Your program must include a main function...
Problem 1.Write a program that prompts the user to enter the number of milliseconds and converts the milliseconds to a string hours:minutes:seconds. The program should use the convertMillismethod with the following header:public static String convertMillis(long millis)For example, convertMillis(5500) returns the string 0:0:5, convertMillis(100000) returns the string 0:1:40, andconvertMillis(555550000) returns the string154:19:10.Problem 2. (Count occurrence of numbers)Write a program that reads integers between 1 and 100 and counts the occurrence of each (you should store the numbers in an array). Output...
Write a program that prompts the user to enter a question
(string) and display whether the
question is correct. It is correct if it ends with the
question mark (?)
----vyrovusmyzustning%20Class.pdf Programs with String Class Write a program that prompts the user to enter a question (string) and display whether the question is correct. It is correct if it ends with the question mark (?) Ask a question? Ask a question? How old are you What is your name? That's...
In Java - Write a program that prompts the user to enter two integers and displays their sum. If the input is incorrect, prompt the user again. This means that you will have a try-catch inside a loop.
java programe
Write a program that prompts the user to enter in an integer number representing the number of elements in an integer array. Create the array and prompt the user to enter in values for each element using a for loop. When the array is full, display the following: The values in the array on a single line. The array with all of the elements reversed. The values from the array that have even numbered values. The values from...