ProDeveloperTutorial.com

Tutorials and Programming Solutions
Menu
  • Shell Scripting
  • System Design
  • Linux System Programming
  • 4g LTE
  • Coding questions
  • C
  • C++
  • DSA
  • GIT
  • 450 DSA Cracker
  • 5G NR
  • O-RAN
Find minimum path from top to bottom in a triangle solution with explanation in C++

Find minimum path from top to bottom in a triangle solution with explanation in C++

For example, given the following triangle , , , ]   The minimum path sum from top to bottom is 11 (i.e., 2 + 3 + 5 + 1 = 11). Follow up question: Bonus point if you are able to do this using only O(n) extra space, where n is the total number of rows in the triangle. …
Full Article
No Comments
Check if the given board is valid Sudoku or not, explanation with solution in C++

Check if the given board is valid Sudoku or not, explanation with solution in C++

Below are the rules for a Sudoku to be valid: Each row must contain the digits 1-9 without repetition. Each column must contain the digits 1-9 without repetition. Each of the 9 3×3 sub-boxes of the grid must contain the digits 1-9 without repetition.   Example 1: Input: , , , , , …
Full Article
No Comments
Given a positive number “k” return the row of that index of pascals triangle, solution in C++

Given a positive number “k” return the row of that index of pascals triangle, solution in C++

Example: Input: 3 Output: Before solving this, have a look at similar problem “pascal’s triangle”. The only difference between this and the previous question is, we need to use o(k) space. We follow the same procedure, but instead of using a 2D vector, we use 1D …
Full Article
No Comments
Given a positive integer, generate pascal triangle, solution in C++

Given a positive integer, generate pascal triangle, solution in C++

Given a non-negative integer numRows, generate the first numRows of Pascal’s triangle. Example: Input: 5 Output: , , , , ] Solution analysis: In each row, the first and last element are 1. And the other element is the sum of the two elements in the …
Full Article
No Comments
Given an array of non overlapping integers, insert a new interval by merging them, solution in C++

Given an array of non overlapping integers, insert a new interval by merging them, solution in C++

Given an array of sorted intervals of  non overlapping integers, insert a new interval into intervals by merging them   Example 1: Input: intervals = ,], newInterval = Output: ,] The solution is very easy. The explanation has been provided in the code as a comment. …
Full Article
No Comments
Given a string of integers, restore all valid IP addresses solution in C++

Given a string of integers, restore all valid IP addresses solution in C++

Given a string containing only digits, get all the valid IP address. Example: Input: "25525511135" Output: The solution for this problem can be done in 2 ways. Iterative/Brute force approach Recursive/DFS But before we solve this, we need to consider below few points: An IP address …
Full Article
No Comments
Reverse Linked List  given 2 points m and n, solution in CPP

Reverse Linked List given 2 points m and n, solution in CPP

Example: Input: 1->2->3->4->5->NULL, m = 2, n = 4 Output: 1->4->3->2->5->NULL Similar problem to reverse whole list. To solve this problem we need to use 4 pointers. Below are the 4 pointers are used: 1. new_head- track head position (new_head.next = head) case: if head is …
Full Article
No Comments
you are given a string having digits, convert into the string by looking at the table given below, solution in C++

you are given a string having digits, convert into the string by looking at the table given below, solution in C++

‘A’ -> 1 ‘B’ -> 2 … ‘Z’ -> 26 Example 1: Input: "12" Output: 2 Explanation: It could be decoded as "AB" (1 2) or "L" (12). The solution is very simple. We shall take 2 variables “r1” and “r2” to store the last and last …
Full Article
No Comments
Check if a given string is a valid number in CPP

Check if a given string is a valid number in CPP

Validate if a given string is numeric. "0" => true " 0.1 " => true "abc" => false "1 a" => false "2e10" => true The problem can be solved in 3 methods: Deterministic Finite Automaton Regex Simple Method We are going to look at 3rd …
Full Article
No Comments
Given array of integers that might contain duplicates, return all the subsets. Solution in CPP

Given array of integers that might contain duplicates, return all the subsets. Solution in CPP

Example: Input: Output: , , , , , ] Before solving this problem, have a look at similar kind of problem Subsets. Similar to the subset 1 problem, we can solve this problem by 2 ways. Iterative Recursive/ Backtrack. We shall discuss both of the solutions …
Full Article
No Comments

Posts navigation

Prev 1 … 70 71 72 73 74 75 76 … 81 Next
  • Shell Scripting
  • System Design
  • Linux System Programming
  • 4g LTE
  • Coding questions
  • C
  • C++
  • DSA
  • GIT
  • 450 DSA Cracker
  • 5G NR
  • O-RAN

ProDeveloperTutorial.com

Tutorials and Programming Solutions
Copyright © 2022 ProDeveloperTutorial.com