Questions and Answers
Problems and Solutions
Quotes help make search much faster. Example: "Practice Makes Perfect"
Tuesday, November 20, 2012
Codecademy: "Sorting the Hash"
#sample solution
puts "Enter a phrase: "
text = gets.chomp
words = text.split(" ")
frequencies = Hash.new(0)
words.each {|element| frequencies[element] += 1}
frequencies = frequencies.sort_by {|a,b| b}
frequencies = frequencies.reverse!
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
Codecademy > Learn Java > Methods: II Sample Solution
class Dog{ int age; public Dog(int dogsAge){ age = dogsAge; } public void bark() { System.out.println("Woof...
Codecademy Using Documentation 7/8
// Sample Solution using System; namespace DocumentationHunt { class Program { static void Main(string[] args) { ...
Codeyear: Creating an array with recursion
//sample solution // Here is the array we will store results in var multiples = []; function multiplesOf(base, i) { // Base case ...
Codefights isCaseInsensitivePalindrome(inputString)
//sample solution function isCaseInsensitivePalindrome(inputString) { var temp = inputString.toLowerCase(); var tempReversed = te...
LearnStreet Python Lesson 9 Exercise 8
#sample solution def run(bottle): #your code here bottle.drink(250) bottle.refill(150) return bottle.amount_left cl...
Codecademy About You Exercises 1 to 4
<!-- sample solutions to Welcome to HTML! --> <h1>Bruce Wayne</h1> <!-- sample solutions to Speak in Paragraphs --> ...
Codecademy: factorial
#sample solution def factorial(x): x = abs(x) #prevents error on negative numbers product = 1 for i in range(x): product = prod...
Codecademy Comparison Operators 3/6
// Sample Solution using System; namespace ComparisonOperators { class Program { static void Main(string[] args) { ...
Codecademy: Sample Solution to "Getting Pickyer"
//Sample solution to script.js $('document').ready(function() { $('#emptyTrash').click(function() { //remove the elemen...
Brahmagupta's Formula For Quadrilateral Area
Question: What is the area of a quadrilateral with sides equal to 18, 22, 39, and 41 respectively? Answer: 798 console.log("******...
No comments:
Post a Comment