Technology, life, programming, travel and money.

Posts Tagged ‘code’

Triangle Identification – C++ solution and test code

Here is another interview coding question that I have heard of. You have to write a function to identify the triangle type. You have to return a number between 1 or 4 to identify either a valid triangle type or an error. The solution is very simple requiring only one condensed line of code to identify each triangle type. Two lines of code [...]

Reverse a linked list – C++ source code

Reversing a linked list is a simple programming problem, which is often a interview question. In this case I'm referring to a singly linked list. I'll provide the C++ solution and the C++ test code. One of the easiest ways to reverse the list is to create a new head pointer, iterate through the list removing each item in turn and then inserting [...]