Oportun interview questions
Problem 1 - Reverse number
Input 1 - x = 123
Output - x = 321
Input 1 - x = -123
Output - x = -321
Input 1 - x = 120
Output - x = 21
Problem 2 - Right rotation
Input - [2, 3, 4, 5, 6, 7],
Index - 3
Output - [4, 5, 6, 7, 2, 3]
Problem 3 - String concat
Input - 45 + 35 + ‘111’
Output - ????
Input - ‘111’ + 45 + 69
Output - ????
var x = 24
(function() {
var x = 43
(function () {
x++
console.log(x) // Output - ???
var x = 21
})()
})()
let x = {
opertorName: 'hello'
getOperatorName: function () {
return this.operatorName
}
}
console.log(x.getOperatoName()) // Output - ???
x.getOperatorName().apply(this, {
operatorName: 'world'
})
console.log(x.getOperatoName())