Skip to content

Instantly share code, notes, and snippets.

@JordanRushing
JordanRushing / functions.lisp
Created July 7, 2019 05:13
Some Lisp Functions
;;;; functions.lisp
;;;; Random useful functions written with SBCL
;; 1
(defun countdown (x)
"Recursively produces all positive integers less
than or equal to x, a non-negative integer, in descending order"
(cond ((< x 0) "negative integer")
((> x 0) (cons x (countdown(- x 1))))
(t nil)))
@JordanRushing
JordanRushing / gist:e3c1f082ea6f62b0bfce6a892ea51be2
Created November 22, 2018 17:57
Remove Duplicates from Sorted Array
class Solution:
def removeDuplicates(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
for i in reversed(range(len(nums))):
if i > 0:
if nums[i] == nums[i - 1]:
del nums[i]