To the Top
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 | 560 Views, 19624 Search Bots | 79 Words

Subscribe to Feed Burner | 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.


def is_shifted(a, b):
# Fill this in.

print is_shifted('abcde', 'cdeab')
# True
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Cateogry: Computing | 560 Views, 19624 Search Bots | 79 Words Subscribe to Feed Burner

Related Articles

  1. Algorithm Interview: Maximum Path Sum in Binary Tree
  2. Print a tree level-by-level, with line-breaks
  3. Making a Height Balanced Binary Search Tree
  4. Algorithm Interview Question: Nth Fibonacci Number
  5. Algorithm Interview: Determine If Linked List is Palindrome
  6. Daily Interview Question: Word Search
  7. 56 Bytes
  8. Daily Interview Problem: Largest BST in a Binary Tree
  9. Batch Programming in XP
  10. Linode Support Ticket 10029540 - Other - Important Notice Regarding Ubuntu 17.10 Image

Comments (0)

    Be the first one to comment this page !


Page Edited: October 30 2020 14:21:09 | RSS Subscription
How to Cook a Perfect Steak? | <meta name="robots" content="index, follow">