File: root - text - article - 2020 - 01 - shifted-string.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 857 Views, 24401 Search Bots | 79 Words
| Browse | Archive
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 857 Views, 24401 Search Bots | 79 Words
| Browse | Archive
Hi, here's your problem today. This problem was recently asked by Apple:
You are given two strings, A and B. Return whether A can be shifted some number of times to get B.
Eg. A = abcde, B = cdeab should return true because A can be shifted 3 times to the right to get B. A = abc and B= acb should return false.
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Cateogry: Computing | 857 Views, 24401 Search Bots | 79 Words You are given two strings, A and B. Return whether A can be shifted some number of times to get B.
Eg. A = abcde, B = cdeab should return true because A can be shifted 3 times to the right to get B. A = abc and B= acb should return false.
def is_shifted(a, b):
# Fill this in.
print is_shifted('abcde', 'cdeab')
# True
Related Articles
- Multitasking
- Making a Height Balanced Binary Search Tree
- Daily Interview Problem: Validate Binary Search Tree
- Daily Interview Problem: Running Median
- Plus One
- Spreadsheet Column Title
- [Daily Problem] Angles of a Clock
- PHP Unit Tests on VPS Server
- Daily Interview Problem: Jump to the End
- Daily Interview Problem: Look and Say Sequence
©2006~2024 SteakOverCooked - 0.00734 Seconds(s) - 2570.559 KB/s - 27 Online Memory: 491.77 KB
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
How to Cook a Perfect Steak? | <meta name="robots" content="index, follow">
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
Comments (0)
Read & Write - Normal - Mini - Post - All Comments - Statistics
Be the first one to comment this page !