Skip to content

An interview problem designed to assess coding skills and understanding of complexity

License

Notifications You must be signed in to change notification settings

ZIJ/find-shortest-substring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

find-shortest-substring

An interview problem designed to assess coding skills and understanding of complexity

Rephrased version of the Minimum Window Substring puzzle

The problem

Given two strings, find the shortest substring of the first string that contains all letters of the second one. Count matters. Examples:

"AAAAABBBB", "BAB" -> "ABB"
"AAABBBCCC", "ABC" -> "ABBBC"
"THELONGTEXT", "ETT" -> "TEXT"

Implementation

  • O(n) CPU / O(n) memory solution based on two hashmaps and two sliding window pointers
  • Written in JavaScript targeting ECMAScript 2015 or newer environments
  • Code style favors readability over compactness

See findShortestSubstring.js

About

An interview problem designed to assess coding skills and understanding of complexity

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published