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 | 624 Views, 21431 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 | 624 Views, 21431 Search Bots | 79 Words Subscribe to Feed Burner

Related Articles

  1. Print a tree level-by-level, with line-breaks
  2. [Daily Problem] Witness of The Tall People
  3. Non-decreasing Array with Single Modification
  4. Top K Frequent words
  5. [Daily Problem] Remove Consecutive Nodes that Sum to 0
  6. [Daily Problem] Angles of a Clock
  7. Daily Interview Problem: Find the k-th Largest Element in a List
  8. Progess made
  9. Daily Interview Question: Create a Simple Calculator
  10. Daily Interview Problem: Reconstrunct Binary Tree from Preorder and Inorder Traversals

Comments (0)

Your Email (Domain Part Not Exposed):

Your Comments:

Privately By Mail Colors More Smileys S x y @

Verification (Click Image 2 Refresh):

    Be the first one to comment this page !


Page Edited: May 11 2024 14:36:49 | RSS Subscription
How to Cook a Perfect Steak? | <meta name="robots" content="noindex, follow" />