Valid Perfect Square

How to check valid perfect square without sqrt (in-built Library function).

Given a positive integer, We have to write a code to returns true if it is a perfect square else false.

For solving this problem, we don’t have to use any built-in library function (such as sqrt).

For Example –

Example 1:

Input:  36

output: true

Example 2:

Input:  17

output: false

Example 3:

Input:  1

output: true

Invert Binary Tree

How to Invert Binary Tree or How to convert a binary tree into its mirror tree.

Given a binary tree, we have to write a code to invert it.

Inverting a Binary Tree

Inverting a binary tree means we have to interchange the left and right children of all non-leaf nodes. In simple words, Output is the mirror of the input tree.