Skip to main content

Posts

Showing posts from March, 2018

Featured Post

Your First Programming Language

What programming language you start with really all depends on where you want to go with programming/coding. The great thing about this field is that there are an absolute abundance of smaller fields that you can go into, all using programming in their own unique ways. For web applications, a good start would be with HTML and later moving your way through CSS, JavaScript, JQuery, PHP, SQL, and any of the JavaScript libraries. Ruby is also a popular choice, so I would recommend checking that out too. For more scientific fields or areas with more machine learning and A.I., Python is generally a great place to start as it is widely used in that field of study. C++ is also a very useful language to know for that, but it can be a little more challenging for beginners. For game and application design, languages such as C#, C, Swift, Kotlin, and Java are most often used for that.

Possible Number of Pies

Description It's Thanksgiving eve and you're expecting guests over for dinner tomorrow. Unfortunately, you were browsing memes all day and cannot go outside to buy the ingredients needed to make your famous pies. You find some spare ingredients, and make do with what you have. You know only two pie recipes, and they are as follows: Pumpkin Pie 1 scoop of synthetic pumpkin flavouring (Hey you're a programmer not a cook) 3 eggs 4 cups of milk 3 cups of sugar Apple Pie 1 apple 4 eggs 3 cups of milk 2 cups of sugar Your guests have no preference of one pie over another, and you want to make the maximum number of (any kind) of pies possible with what you have. You cannot bake fractions of a pie, and cannot use fractions of an ingredient (So no 1/2 cup of sugar or anything like that) Input Format You will be given a string of 4 numbers separated by a comma, such as 10,14,10,42,24. Each number is a non-negative integer. The numbers represent the number of syntheti

How to Connect Visual Studio with MySQL Database

Tester Developer and Bug

Making Simple MATH QUIZ Game | NetBeans

Ancient Flash Drive

Learn 1 To 10 From Bill Gates

Integer Complexity 3

Background The integer complexity of a positive integer is the minimum possible sum of the numbers used in an expression - using only positive integers, addition, multiplication, and parentheses - that's equal to the given number. See this week's Intermediate challenge for examples and more information. The typical definition of integer complexity disallows all numbers in the expression other than 1. This definition is equivalent, so either one you want to use is fine. As far as I know, efficiently determining the integer complexity of a given number is an open question. Your challenge is to provide as tight an upper limit as possible for a particular input. Challenge Post an expression equal to 12345678910111213 - using only positive integers, addition, multiplication, and parentheses - such that the sum of the numbers in the expression is as small as possible. Here's one example: 1+4*3*3*3*(1+4*4*(1+3*(1+3*(1+5*3*3*(1+5*4*4*2*(1+4*3*(1+4*4*3*2*(2+5*(1+5*4*3*(

Programmer's Quote

Integer Complexity 2

Background Consider all the different ways of representing a positive integer using nothing but positive integers, addition, multiplication, and parentheses. For 5678, a few such ways are: 5678 = 2*17*167 5678 = 5678 5678 = 23*59+29*149 5678 = (1+4*4)*(1+3*3*(1+3*3*4)) 5678 = 2*(1+2*(1+2*(1+2*2*(1+2*2*2*2*(1+2*(1+2*2)))))) For each such representation, consider the sum of the integers involved: 2*17*167 => 2+17+167 = 186 5678 => 5678 = 5678 23*59+29*149 => 23+59+29+149 = 260 (1+4*4)*(1+3*3*(1+3*3*4)) => 1+4+4+1+3+3+1+3+3+4 = 27 2*(1+2*(1+2*(1+2*2*(1+2*2*2*2*(1+2*(1+2*2)))))) =>     2+1+2+1+2+1+2+2+1+2+2+2+2+1+2+1+2+2 = 30 For 5678, the minimum possible sum for any such representation is 27. The minimum possible sum for a given integer is known as its integer complexity, so the integer complexity of 5678 is 27. The integer complexity of the numbers 1, 2, 3, ... is: 1 2 3 4 5 5 6 6 6 7 8 7 8 8 8 8 9 8 9 9 ... The sum of the integer complexities for all

Pass By Reference and Pass By Value

Data Warehousing Before Computer Age

Integer Complexity 1

Challenge Given a number A, find the smallest possible value of B+C, if B*C = A. Here A, B, and C must all be positive integers. It's okay to use brute force by checking every possible value of B and C. You don't need to handle inputs larger than six digits. Post the return value for A = 345678 along with your solution. For instance, given A = 12345 you should return 838. Here's why. There are four different ways to represent 12345 as the product of two positive integers: 12345 = 1*12345 12345 = 3*4115 12345 = 5*2469 12345 = 15*823 The sum of the two factors in each case is: 1*12345 => 1+12345 = 12346 3*4115 => 3+4155 = 4158 5*2469 => 5+2469 = 2474 15*823 => 15+823 = 838 The smallest sum of a pair of factors in this case is 838. Examples 12 => 7 456 => 43 4567 => 4568 12345 => 838 The corresponding products are 12 = 3*4, 456 = 19*24, 4567 = 1*4567, and 12345 = 15*823. Hint Want to test whether one number divides evenly into

Create a Simple Stochastic Computing

Description Stochastic computing, first introduced by the noted scientist John von Neumann in 1953, is a collection of techniques that represent continuous values (for example probabilities between 0 and 1) using streams of random bits. The bits in the stream represent the probabilities. Complex computations can then be computed over these stream by applying simple bit-wise operations. For example, given two probabilities p and q, using 8 bits, to represent the probabilities 0.5 and 0.25: 10011010 01010000 To calculate p x q we apply the logical AND over the bitstream: 00010000 Yielding 1/8, or 12.5%, the correct value. For an 8-bit stream, this is the smallest unit of precision we can calculate. To increase precision we must increase the size of the bitstream. This approach has a few benefits in a noisy environment, most importantly a tolerance for loss (for example in transmission) and better fidelity over various bit lengths. However, precision comparable to a standard

I Will Find It And Install

The Pancake Sorting Problem

Description I work as a waiter at a local breakfast establishment. The chef at the pancake house is sloppier than I like, and when I deliver the pancakes I want them to be sorted biggest on bottom and smallest on top. Problem is, all I have is a spatula. I can grab substacks of pancakes and flip them over to sort them, but I can't otherwise move them from the middle to the top. How can I achieve this efficiently? This is a well known problem called the pancake sorting problem. Bill Gates once wrote a paper on this that established the best known upper bound for 30 years. This particular challenge is two-fold: implement the algorithm, and challenge one another for efficiency. Input Description You'll be given a pair of lines per input. The first line tells you how many numbers to read in the next line. The second line tells you the pancake sizes as unsigned integers. Read them in order and imagine them describing pancakes of given sizens from the top of the plate to t

Error On Line 144?

Closest String

Description In theoretical computer science, the closest string is an NP-hard computational problem, which tries to find the geometrical center of a set of input strings. To understand the word "center", it is necessary to define a distance between two strings. Usually, this problem is studied with the Hamming distance in mind. This center must be one of the input strings. In bioinformatics, the closest string problem is an intensively studied facet of the problem of finding signals in DNA. In keeping with the bioinformatics utility, we'll use DNA sequences as examples. Consider the following DNA sequences: ATCAATATCAA ATTAAATAACT AATCCTTAAAC CTACTTTCTTT TCCCATCCTTT ACTTCAATATA Using the Hamming distance (the number of different characters between two sequences of the same length), the all-pairs distances of the above 6 sequences puts ATTAAATAACT at the center. Input Description You'll be given input with the first line an integer N telling you how ma

Write A Web Crawler

Description Most of us are familiar with web spiders and crawlers like GoogleBot - they visit a web page, index content there, and then visit outgoing links from that page. Crawlers are an interesting technology with continuing development. Web crawlers marry queuing and HTML parsing and form the basis of search engines etc. Writing a simple crawler is a good exercise in putting a few things together. Writing a well behaved crawler is another step up. For this challenge you may use any single shot web client you wish, e.g. Python's httplib or any of a number of libcurl bindings; you may NOT use a crawling library like Mechanize or whatnot. You may use an HTML parsing library like BeautifulSoup; you may NOT use a headless browser like PhantomJS. The purpose of this challenge is to tie together fetching a page, reassembling links, discovering links and assembling them, adding them to a queue, managing the depth of the queue, and visiting them in some reasonable order - while av

Making a simple SNAKE Game

Making a simple SNAKE Game | Unity