Tweaked kth to last element challenge algorithm description.

This commit is contained in:
Donne Martin 2015-07-05 16:50:16 -04:00
parent 55c40e91a5
commit 63bf44efac

View File

@ -66,13 +66,13 @@
"## Algorithm\n", "## Algorithm\n",
"\n", "\n",
"* Setup two pointers, current and previous\n", "* Setup two pointers, current and previous\n",
"* Give current a headstart, incrementing it once for k = 1, twice for k = 2, etc\n", "* Give current a headstart, incrementing it once if k = 1, twice if k = 2, ...\n",
"* Increment both pointers until current reaches the end\n", "* Increment both pointers until current reaches the end\n",
"* Return the value of previous\n", "* Return the value of previous\n",
"\n", "\n",
"Complexity:\n", "Complexity:\n",
"* Time: O(n)\n", "* Time: O(n)\n",
"* Space: In-place" "* Space: O(1)"
] ]
}, },
{ {