Five Programming Problems

Developer
Size
4,091 Kb
Views
8,096

How do I make an five programming problems?

Https://blog.svpino.com/2015/05/07/five-programming-problems-every-software-engineer-should-be-able-to-solve-in-less-than-1-hour. What is a five programming problems? How do you make a five programming problems? This script and codes were developed by Bryan Fillmer on 11 December 2022, Sunday.

Five Programming Problems Previews

Five Programming Problems - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Five Programming Problems</title> <script src="https://s.codepen.io/assets/libs/modernizr.js" type="text/javascript"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootswatch/3.3.4/darkly/bootstrap.min.css'> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ @import "lesshat"; </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <body ng-app="fiveApp" ng-controller="ApplicationController as ac"> <div class="container"> <h1>Five Programming Problems</h1> <h3>Problem One [12 Minutes]</h3> <p>Write three functions that compute the sum of the numbers in a given list using a for-loop, a while-loop, and recursion.</p> <ul> <li>List: {{ac.problemOneList}}</li> <li>Sum For: {{ac.sumFor}}</li> <li>Sum While: {{ac.sumWhile}}</li> <li>Sum Recursive: {{ac.sumRecursive}}</li> </ul> <h3>Problem Two [18 minutes]</h3> <p>Write a function that combines two lists by alternatingly taking elements. For example: given the two lists [a, b, c] and [1, 2, 3], the function should return [a, 1, b, 2, c, 3].</p> <ul> <li>List One: {{ac.problemTwoListOne}}</li> <li>List Two: {{ac.problemTwoListTwo}}</li> <li>Combine One: {{ac.problemTwoCombineOne}}</li> <li>Combine Two: {{ac.problemTwoCombineTwo}}</li> </ul> <h3>Problem Three [12 minutes]</h3> <p>Write a function that computes the list of the first 100 Fibonacci numbers. By definition, the first two numbers in the Fibonacci sequence are 0 and 1, and each subsequent number is the sum of the previous two. As an example, here are the first 10 Fibonnaci numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, and 34.</p> <ul> <li>First 100 Fibonacci: {{ac.fibonacci}}</li> </ul> <h3>Problem Four [20 minutes]</h3> <p>Write a function that given a list of non negative integers, arranges them such that they form the largest possible number. For example, given [50, 2, 1, 9], the largest formed number is 95021.</p> <ul> <li>List: {{ac.nonNegatives}}</li> <li>Largest Formed: {{ac.largestFormed}}</li> </ul> <h3>Problem Five</h3> <p>Write a program that outputs all possibilities to put + or - or nothing between the numbers 1, 2, ..., 9 (in this order) such that the result is always 100. For example: 1 + 2 + 34 – 5 + 67 – 8 + 9 = 100.</p> <ul> <li></li> </ul> </div>
</body> <script src='http://ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Five Programming Problems - Script Codes CSS Codes

@import "lesshat";

Five Programming Problems - Script Codes JS Codes

(function () { 'use strict'; function ApplicationController() { var ac = this; /** * Problem One: 2:26 - 2:38 [12 minutes] * Write three functions that compute the sum of the numbers in a given * list using a for-loop, a while-loop, and recursion. */ function sumFor (nums) { var sum = 0; for (var i = 0; i < nums.length; i++) { sum = sum + nums[i]; } return sum; } function sumWhile (nums) { var sum = 0, i = 0; while (i < nums.length) { sum = sum + nums[i]; i++; } return sum; } function sumRecursive (nums) { var sum = 0; var sumRecursiveSum = function (v) { sum = sum + v; }; nums.map(sumRecursiveSum); return sum; } ac.problemOneList = [1, 2, 3]; ac.sumFor = sumFor(ac.problemOneList); ac.sumWhile = sumWhile(ac.problemOneList); ac.sumRecursive = sumRecursive(ac.problemOneList); /** * Problem 2: 2:40 - 2:58 [18 minutes] * Write a function that combines two lists by alternatingly taking elements. * For example: given the two lists [a, b, c] and [1, 2, 3], the function * should return [a, 1, b, 2, c, 3]. */ // Separate out primary combination logic. function runCombine (x, y) { var list = []; for (var i = 0; i < x.length; i++) { list.push(x[i]); if (i < y.length) { list.push(y[i]); } } return list; } // Always run longest list first. function combineLists (o, t) { if (o.length > t.length) { return runCombine(o, t); } else { return runCombine(t, o); } }	ac.problemTwoListOne = [1, 2, 3]; ac.problemTwoListTwo = ['a', 'b']; ac.problemTwoCombineOne = combineLists(ac.problemTwoListOne, ac.problemTwoListTwo); ac.problemTwoCombineTwo = combineLists(ac.problemTwoListTwo, ac.problemTwoListOne); /** * Problem Three: 3:04 - 3:16 [12 minutes] * Write a function that computes the list of the first 100 * Fibonacci numbers. By definition, the first two numbers * in the Fibonacci sequence are 0 and 1, and each subsequent * number is the sum of the previous two. As an example, here * are the first 10 Fibonnaci numbers: 0, 1, 1, 2, 3, 5, 8, * 13, 21, and 34. */ function getFibonacci (n) { var current = 1, fibs = [0, 1]; for (var i = 2; i <= n; i++) { current = current + fibs[i - 2]; fibs.push(current); } return fibs; } ac.fibonacci = getFibonacci(100); /** * Problem Four: 3:20 - 3:40 [20 minutes] * Write a function that given a list of non negative integers, * arranges them such that they form the largest possible number. * For example, given [50, 2, 1, 9], the largest formed number is 95021. */ function formVoltron (list) { list.sort(function (x, y) { var o = String(x), t = String(y), compareOneStr = o + t, compareTwoStr = t + o, compareOneInt = parseInt(compareOneStr), compareTwoInt = parseInt(compareTwoStr); return (compareOneInt < compareTwoInt); }); return list.reduce(function (x, y) { return String(x) + String(y); }); } ac.nonNegatives = [50, 2, 1, 9]; ac.largestFormed = formVoltron(ac.nonNegatives); /** * Problem Five: 3:45 - * Write a program that outputs all possibilities to * put + or - or nothing between the numbers 1, 2, ..., 9 * (in this order) such that the result is always 100. * For example: 1 + 2 + 34 – 5 + 67 – 8 + 9 = 100. */ } angular .module('fiveApp', []) .controller('ApplicationController', ApplicationController);
})();
Five Programming Problems - Script Codes
Five Programming Problems - Script Codes
Home Page Home
Developer Bryan Fillmer
Username bfillmer
Uploaded December 11, 2022
Rating 3
Size 4,091 Kb
Views 8,096
Do you need developer help for Five Programming Problems?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Bryan Fillmer (bfillmer) Script Codes
Create amazing video scripts with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!