employer cover photo
employer logo
employer logo

Clearwater Analytics (CWAN)

Engaged employer

Clearwater Analytics (CWAN) interview question

Write a method that accepts an integer and then returns an integer with the digits reversed. For example, if the integer 123 is passed in, the integer 321 is returned.

Interview Answer

Anonymous

29 Sept 2011

It was an interesting intellectual problem but a terrible example of what a software engineer should do. If I had a boss that told me to solve a problem like this, I would tell him to go home and sober up because only a drunk man thinks like this. I answered it using mod 10 and div 10 functions to pull each number off and then reassemble the reversed number.