Category: c / c++
Given a binary tree, return the sum of values of nodes with even-valued grandparent. (A grandparent of a node is the parent of its parent, if it exists.) If …
Given an integer n. No-Zero integer is a positive integer which doesn’t contain any 0 in its decimal representation. Return a list of two integers where: A and B …
Given a positive integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. Example: Input: 3 Output: , , ] Walk and Turn …
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. Example 1: Input: 1-2-3-3-4-4-5 Output: 1-2-5 Example 2: Input: …
Although, sorting a linked list can be done via Recursive Divide-and-Conquer algorithm i.e. merge sorting, we can however, turn the linked list into an array (or vector) using O(N) …