datastructures-in-python
  • Home
  • Downloads & Misc-Assets
  • README
  • Navigation
  • Curriculum
    • Outline
      • General Content
      • Python-Data-Structures-Unit
    • wk17
      • Outline-w17
      • homework
      • D1-Module 01 - Python I
        • Configuring Ubuntu for Python Web Development
        • Install Python
      • D2- Module 02 - Python II
      • D3- Module 03 - Python III
      • D4-Module 04 - Python IV
    • wk18
      • Outline-W-18
      • D1- Module 01 - Number Bases and Character Encoding
      • D2- Module 02 - Hash Tables I
        • Hash Table / Hash Map In Python:
        • Hash Table Use Cases
        • Practice
      • D3-Module 03 - Hash Tables II
      • D4- Module 04 - Searching and Recursion
    • wk19
      • Outline-W-19
      • D1- Module 01 - Linked Lists
        • Homework
          • Helpful Resource
      • D2- Module 02 - Queues and Stacks
      • D3- Module 03 - Binary Search Trees
        • BST Definition:
      • D4- Module 04 - Tree Traversal
        • Tree Traversals (Inorder, Preorder and Postorder)
    • wk20
      • Outline-W-20
      • D1-Graphs I
      • D2-Graphs 2
      • DFS
      • D4
  • Utilities
    • Utilites
      • Python Libraries
      • YouTube
      • Code Lab Notebook Embeds From Lecture
    • Code lab Notebooks
    • Repl.IT
      • Trinket
  • Abstract Data Structures
    • Algorithms
      • Algo-Resources
        • List-Of-Solutions-To-Common-Interview-Questions
      • Dijkstra's algorithm
      • Calculate a Factorial With Python - Iterative and Recursive
      • DFS
      • BFS
        • BFS Examples
      • Palendrome
    • Data Structures Overview
      • General Data Structures Notes
        • DS-Explained-Simple
      • Untitled
      • Algorithms
      • Dictionary
    • Abstract Data Structures:
      • Array
        • Extra-Array
        • Array Practice
      • Binary Search
      • Binary Tree
        • Binary Tree Explained
        • Find the maximum path sum between two leaves of a binary tree
      • Binary Search Tree
        • BST Explained
        • BST Insert
        • BST-Largest-Sub-Tree
      • Exotic
        • Tire
        • Dynamic Programming
      • Graphs
        • Overflow Practice Problems
        • Graphs Explained
        • Earliest Ancestor
        • _Mini Graph-Projects
          • # Social Graph
          • number of 1 islands
          • Searching and Generating Graphs
        • Graph FAQ
          • Graph DFS
        • Connected Components
        • Randomness
        • Graph BFS
        • Topological Sort
      • Hash Table
        • Hashmap or Hash tables
        • Hash Table and HashMap in Python
      • Heap
        • Heap Examples
      • String
      • Map
        • Examples
      • Queue
        • Queue Continued...
        • Queue Sandbox
        • Dequeue
      • Tree
        • In Order Traversal
        • Tree Equal ?
        • Ternary-search-trees
        • Red_Black Tree
        • Tree Mirror:
        • Tree Traversal
      • Recursion
        • Recursion Explained
          • Recursion Examples
      • Linked List
        • Linked List Background
        • Double Linked List
        • List Example
        • Examples (LL) continued
        • List Operations
      • Set
        • Set
        • Set Intersection Union
        • Disjoint Set
      • Sorting
        • In JavaScript
        • Merge Sort
        • Iterative Sorting
        • Recursive Sorting
        • Graph Topological Sort
        • SelectionSort
        • Quick Sort
        • Merge Sort
        • Insertion Sort
      • Stack
        • Stack Continued
        • Stack Part 3
      • Searching
        • Binary Search
        • Searching & Sorting Computational Complexity (JS)
  • practice
    • GCA Sprint Prep:
      • Practice Problems
      • Code Signal CGA Sprint Resources
      • CGA-Sprint Prep
    • Supplemental Practice:
      • Practice
      • JavaScript Algorithms
      • Industry Standard Algorithms
        • Interview Practice Resources
        • Write a Program to Find the Maximum Depth or Height of a Tree
      • Random Examples
      • Prompts
      • JS_BASICS
  • Resources
    • Python Cheat Sheet
      • Cheatsheet-v2
      • List Of Python Cheat Sheets
    • Youtube
    • PDF Downloads
    • Intro 2 Python
    • Dictionaries
      • Dictionaries Continued
    • Python VS JavaScript
    • Misc. Resources
    • Things To Internalize:
      • Functions
    • Intro To Python w Jupyter Notebooks
    • Calculating Big O
    • Useful Links
      • Awesome Python
      • My-Links
      • Beginners Guide To Python
  • Docs
    • Docs
      • Strings
        • Strings Continued
      • Touple
      • Values Expressions & Statments
      • Dictionaries, sets, files, and modules
        • Modules
      • Built-in Types
      • Built In Functions
        • Zip Function
      • Functions
      • Classes and objects
        • Inheritance
        • Classes
          • Python Objects & Classes
          • index
      • Dictionaries
      • Conditionals and loops
      • Lists
        • Reverse A List
        • Python Data Structures
        • More On Lists
        • Examples
          • More-Examples
        • List Compehensions
      • Basic Syntax
      • String-Methods
    • Queue & Stacks
  • quick-reference
    • My Medium Articles
    • Free Python Books
    • WHY Python?
    • Debugging
    • Python Snippets
    • Python3 Regex
    • Python Module Index:
      • Requests Module
    • Creating Python Modules
    • Useful Info
    • Python Glossary
    • Python Snippets
  • MISC
    • Built-in Methods & Functions
    • Data Structures Types
    • Math
    • Unsorted Examples
    • Outline
    • About Python
      • Python VS JavaScript
      • Python Modules & Python Packages
      • Misc
      • Python's Default Argument Values and Lists
      • SCRAP
  • Interview Prep
    • Interview Resources
      • By Example
        • Algo-Prep
      • Permutation
      • How to Write an Effective Resume of Python Developer
      • Interview Checklist
      • 150 Practice Problems & Solutions
  • Installations Setup & Env
    • python-setup
    • Installing Python Modules
    • Set Up Virtual Enviornment
  • Aux-Exploration
    • Related Studies
      • Self-Organizing Maps: Theory and Implementation in Python with NumPy
      • List Directory Contents
      • Employee Manager
      • OS Module
      • server-side-scripting
      • Web Scraping
      • Reading and Writing to text files in Python
      • General Data Structures
      • Touple
      • How to round Python values to whole numbers?
      • Python Array Module
      • Data Structures In JavaScript
      • Dunder Methods
      • Python GitHub API
      • JS-Event Loop
      • JavaScript Event Loop
      • Manipulating Files & Folders
  • experiments
    • Untitled
Powered by GitBook
On this page

Was this helpful?

Export as PDF
  1. Abstract Data Structures
  2. Abstract Data Structures:

String

PreviousHeap ExamplesNextMap

Last updated 3 years ago

Was this helpful?

String

  • Output list of strings representing a page of hostings given a list of CSV strings.

  • Given a list of words, find the word pairs that when concatenated form a palindrome.

  • Find the most efficient way to identify what character is out of place in a non-palindrome.

  • Implement a simple regex parser which, given a string and a pattern, returns a boolean indicating whether the input matches the pattern. By simple, we mean that the regex can only contain the following special characters: * (star), . (dot), + (plus). The star means that there will be zero or more of the previous character in that place in the pattern. The dot means any character for that position. The plus means one or more of previous character in that place in the pattern.

  • Find all words from a dictionary that are x edit distance away.

  • Given a string IP and number n, print all CIDR addresses that cover that range.

  • Write a function called eval, which takes a string and returns a boolean. This string is allowed 6 different characters: 0, 1, &, |, (, and ). eval should evaluate the string as a boolean expression, where 0 is false, 1 is true, & is an and, and | is an or.

    • E.g "(0 | (1 | 0)) & (1 & ((1 | 0) & 0))"

  • Given a pattern string like "abba" and an input string like "redbluebluered", return true if and only if there's a one to one mapping of letters in the pattern to substrings of the input.

    • E.g. "abba" and "redbluebluered" should return true.

    • E.g. "aaaa" and "asdasdasdasd" should return true.

    • E.g. "aabb" and "xyzabcxzyabc" should return false.

  • If you received a file in chunks, calculate when you have the full file. Quite an open-ended question. Can assume chunks come with start and end, or size, etc.

  • Given a list of names (strings) and the width of a line, design an algorithm to display them using the minimum number of lines.

  • Design a spell-checking algorithm.

  • Count and say problem.

  • Longest substring with K unique characters.

  • Given a set of random strings, write a function that returns a set that groups all the anagrams together.

  • Given a string, find the longest substring without repeating characters. For example, for string 'abccdefgh', the longest substring is 'cdefgh'.

  • Given a string, return the string with duplicate characters removed.

  • Write a function that receives a regular expression (allowed chars = from 'a' to 'z', '*', '.') and a string containing lower case english alphabet characters and return true or false whether the string matches the regex.

    • E.g. 'ab*a', 'abbbbba' => true.

    • E.g. 'ab*b.', 'aba' => true.

    • E.g. 'abc*', 'acccc' => false.

  • Given a rectangular grid with letters, search if some word is in the grid.

  • Given two strings representing integer numbers ('123' , '30') return a string representing the sum of the two numbers: '153'.

  • A professor wants to see if two students have cheated when writing a paper. Design a function hasCheated(String s1, String s2, int N) that evaluates to true if two strings have a common substring of length N.

    • Follow up: Assume you don't have the possibility of using String.contains() and String.substring(). How would you implement this?

  • Print all permutations of a given string.

  • Parse a string containing numbers and '+', '-' and parentheses. Evaluate the expression. -2+(3-5) should return -4.

  • Output a substring with at most K unique characters.

    • E.g. 'aabc' and k = 2 => 'aab'.

  • Ensure that there are a minimum of N dashes between any two of the same characters of a string.

    • E.g. n = 2, string = 'ab-bcdecca' => 'ab--bcdec--ca'.

  • Find the longest palindrome in a string.

  • Give the count and the number following in the series.

    • E.g. 1122344, next: 21221324, next: 12112211121214.

    • Count and say problem.

  • Compress a string by grouping consecutive similar questions together:

    • E.g. 'aaabbbcc' => 'a3b3c2'`.

  • You have a string consisting of open and closed parentheses, but parentheses may be imbalanced. Make the parentheses balanced and return the new string.

  • Given a set of strings, return the smallest subset that contains prefixes for every string.

    • E.g. ['foo', 'foog', 'food', 'asdf'] => ['foo', 'asdf'].

  • Write a function that would return all the possible words generated when using a phone (pre-smartphone era) numpad to type.

  • Given a dictionary and a word, find the minimum number of deletions needed on the word in order to make it a valid word.

  • How to check if a string contains an anagram of another string?

  • Find all k-lettered words from a string.

  • Given a string of open and close parentheses, find the minimum number of edits needed to balance a string of parentheses.

  • Run length encoding - Write a string compress function that returns 'R2G1B1' given 'RRGB'.

  • Write a function that finds all the different ways you can split up a word into a concatenation of two other words.

Source
Source
Source
Source
Source
Array
Binary Search Tree
Linked List
Extra-Array
Stack
Binary Tree
Recursion
Hash Table
Searching
Sorting
Queue Sandbox
Hash Table
Double Linked List
Graphs
Exotic
Heap