Write a function to find the longest substring without repeating characters.
MediumProblem Statement
Write a function to find the longest substring without repeating characters.
Sample Input
A string: "abcabcbb"
Sample Output
Longest substring: "abc"
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
fun maxDifference(arr: Array<Int>): Int {
// Add your code here to find the maximum difference
}
fun main() {
val array = arrayOf(2, 3, 10, 6, 4, 8, 1)
println("The maximum difference is: ${maxDifference(array)}")
}
Input
A string: "abcabcbb"
Expected Output
Longest substring: "abc"