list

This tag is associated with 6 posts

C++: Flatten a List

Write a function to flatten the nesting in an arbitrary list of values. Your program should work on the equivalent of this list: [[1], 2, [[3,4], 5], [[[]]], [[[6]]], 7, 8, []] Where the correct result would be the list: [1, 2, 3, 4, 5, 6, 7, 8] #include <list> #include <boost/any.hpp> typedef std::list<boost::any> anylist; … Continue reading »

C++: Greatest Element of a List

Create a function that returns the maximum value in a provided set of values, where the number of values may not be known until runtime. This will work for any type with a < operator defined. Uses the standard library function max_element(). #include <algorithm> #include <cassert> template<typename Ty> Ty max(unsigned int count, Ty values[]) { … Continue reading »

C++: Compare a List of Strings

Given a list of arbitrarily many strings, show how to: test if they are all lexically equal test if every string is lexically less than the one after it (i.e. whether the list is in strict ascending order) Each of those two tests should result in a single true or false value, which could be … Continue reading »

C++: List Comprehensions

A list comprehension is a special syntax in some programming languages to describe lists. It is similar to the way mathematicians describe sets, with a set comprehension, hence the name. Some attributes of a list comprehension are that: They should be distinct from (nested) for loops within the syntax of the language. They should return … Continue reading »

2016 30 Under 30

Name: Palmer Luckey Profession: Founder of Oculus VR Age: 23 Quote: “I was interested in virtual reality for several years even before working at USC, it wasn’t an interest that started there at all” Name: Nik Grishakov Profession: Founder of ShipIt Age: 25 Quote: “ShipIt will help you earn money while travelling” Name: Drake Profession: Music Age: 29 Quote: “I’m … Continue reading »

8 Best Low Budget, High Concept Movies

1. Timelapse Three flatmates discover a neighbour has a camera pointed at their lounge window, which takes a polaroid photo at 8 o’clock every day – but the photos it takes come from 24 hours in the future.   2. Circle A group of people awake in a circular room. They have no idea how … Continue reading »

Become a TFE Insider!