Domanda di colloquio di Futurex

Reverse a string without using a loop in C.

Risposte di colloquio

Anonimo

20 ott 2016

The simplest way to reverse a string or any other container without an explicit loop in C++ is to use reverse iterators: string input; cin >> input; // the pair of iterators rbegin/rend represent a reversed string string output ( input.rbegin ( ), input.rend ( ) ) ; cout << output << endl;

Anonimo

23 set 2014

The desired method was to use recursion to build a stack and then undo it to print the string.