Questions and Answers
Problems and Solutions
Quotes help make search much faster. Example: "Practice Makes Perfect"
Thursday, December 22, 2016
Codefights def simpleSort(arr)
#sample solution
def simpleSort(arr):
n = len(arr)
for i in range(n):
j = 0
stop = n - i
while j < stop - 1:
if arr[j] > arr[j + 1]:
temp = arr[j+1]
arr[j+1] = arr[j]
arr[j] = temp
j += 1
return arr
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
This is an example of
scrolling text
using Javascript.
Popular Posts
Compounding: Finding the Present Value of an Annuity
A typical compounding problem would be something like: How much is the equivalent Present Value (P) if an investment pays an amount (A...
Codecademy Sample Solution: Codeyear Get to the back of the line!
<style> span { background-image: url('http://hosturl.co.uk/cc/lady2.png'); width: 105px; heig...
Codecademy: String Rotation
// Sample solution // Write a string rotation method. // It should pass all the tests given below. String.prototype.rotate = function(n...
Compounding: Finding the Annuity given its Present Value
A typical compounding problem would be something like: How much will I get annually (A) starting next year if I invest a present value...
Compounding: Finding the Future Value given the Present Value
A typical compounding problem would be something like: What is the future value (F) of a present value (P) deposited/lent at an intere...
Codecademy: Inheritance Syntax
#sample solution class Shape(object): """Makes shapes!""" def __init__(self, number_of_sides): self....
Compounding: Finding the Present Value given the Future Value
A typical compounding problem would be something like: What is the present value (P) of a future value (F) if (P) was deposited/lent a...
What is the area of a trapezoid?
Type in the length of the shorter base of the trapezoid: meters Type in the length of the longer base of the trapezoid: meters ...
What is the area of an N-sided regular polygon?
A regular polygon has sides of equal length. Type in the length of the side of a sided regular polygon: meters Compute
After death, which organ putrefies last?
The spleen
No comments:
Post a Comment