SHARE
TWEET

Untitled

a guest Mar 22nd, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. func remove(word: String) -> Bool {
  2.         var deleteWord = Array(word)
  3.         var nodes = getNodesList(word: word)
  4.         guard nodes != nil else {return false}
  5.         var wordIndex = deleteWord.count - 1
  6.         for nodeIdx in (1..<nodes!.count - 1 ).reversed() {
  7.             if ( nodes![nodeIdx].children[ deleteWord[wordIndex] ]!.children.count < 1 ) {
  8.                  nodes![nodeIdx].children[ deleteWord[wordIndex] ] = nil
  9.             }
  10.             wordIndex -= 1
  11.         }
  12.         return true
  13.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top