-
-
Save asadali3210/2891f050ac8a509ea7e316bfdbd74656 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Given an array of characters, write a function that finds the maximum sequence of characters at the end of this array that are the same as the beginning of the array. | |
Input: Array of Characters | |
Output: Array of Characters | |
Examples: | |
Input = [a,b,c,e,r,t,x,s,b,a,b,c] | |
Output = [a,b,c] | |
(because a,b,c are both at the beginning and end of the array and is the maximum sequence of such characters) | |
Input = [q,e,r,l,q,e,r,l] | |
Output = [q,e,r,l] | |
Input = [r,j,k,e,r,s,b,a,b,c] | |
Output = [] | |
(empty array, because no sequence of same characters exists at the beginning and end of the array) | |
Instructions: | |
- You can choose any programming language. | |
- Don't use any built-in functions in any language. Just write your own algorithm and functions as needed. | |
- Don’t do search on Google for the answers. Please do the answer based on your best knowledge. | |
- Please do all of your answers in the provided answer field. Use of any other text editor is not allowed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment