Commit f6b36c3

mo <mokha@cisco.com>
2017-07-05 23:21:11
add bcc32 solution.
1 parent 483474a
Changed files (1)
spec/remove_k_from_list_spec.rb
@@ -54,6 +54,20 @@ describe "remove_k_from_list" do
     head
   end
 
+  def not_target(head, target)
+    head = head.next while head && head.value == target
+    head
+  end
+
+  def remove_k_from_list(head, target)
+    head = node = not_target(head, target)
+    while node
+      node.next = not_target(node.next, target)
+      node = node.next
+    end
+    head
+  end
+
   class ListNode
     attr_accessor :value, :next