Skip to main content

Posts

Showing posts from April, 2023

Full Stack Developer Without Degree: How to Become One

If you're interested in becoming a Full Stack Developer without a degree, we've put together some tips and resources to help you get started. Learn the Fundamentals The first step to becoming a Full Stack Developer is to learn the fundamentals of coding. You can start with HTML, CSS, and JavaScript, which are the building blocks of web development. There are plenty of free resources available online, such as Codecademy and FreeCodeCamp, which offer interactive courses that teach you the basics of web development. Once you have a solid understanding of the basics, you can move on to more advanced topics such as back-end development, databases, and frameworks. You can learn these topics through online courses or by working on personal projects. Build a Portfolio One of the most important things you can do as a Full Stack Developer is to build a portfolio. Your portfolio should showcase your skills and experience and demonstrate your ability to build real-world applications. You c

Full Stack Developer Without Degree: How to Become One

If you're interested in becoming a Full Stack Developer without a degree, we've put together some tips and resources to help you get started. Learn the Fundamentals The first step to becoming a Full Stack Developer is to learn the fundamentals of coding. You can start with HTML, CSS, and JavaScript, which are the building blocks of web development. There are plenty of free resources available online, such as Codecademy and FreeCodeCamp, which offer interactive courses that teach you the basics of web development. Once you have a solid understanding of the basics, you can move on to more advanced topics such as back-end development, databases, and frameworks. You can learn these topics through online courses or by working on personal projects. Build a Portfolio One of the most important things you can do as a Full Stack Developer is to build a portfolio. Your portfolio should showcase your skills and experience and demonstrate your ability to build real-world applications. You c

Javascript Prototype

  what is javascript prototype ? In JavaScript, a prototype is an object from which other objects inherit properties and methods. When you create an object in JavaScript, it is assigned a prototype, which is used to look up properties and methods that are not defined on the object itself. The prototype is essentially a template for an object, and it can be used to define default values for properties and methods that all objects created from it will have. By modifying the prototype, you can add new properties and methods to all objects created from it. In JavaScript, each object has a special property called [[Prototype]] (also called __proto__), which points to its prototype. When you try to access a property or method on an object that is not defined on the object itself, JavaScript will look up the prototype chain until it finds the property or method. For example, consider the following code: function Person(name) {   this.name = name; } Person.prototype.greet = function() {   cons

Anagram (DSA)

  Problem Statement :(👈click here for GFG) Given two strings  a  and  b  consisting of lowercase characters. The task is to check whether two given strings are an anagram of each other or not. An anagram of a string is another string that contains the same characters, only the order of characters can be different. For example, act and tac are an anagram of each other. Note:- If the strings are anagrams you have to  return True or else return False |s|  represents the length of string s. Example 1: Input: a = geeksforgeeks, b = forgeeksgeeks Output: YES Explanation: Both the string have same characters with same frequency. So, both are anagrams. Example 2: Input: a = allergy, b = allergic Output: NO Explanation: Characters in both the strings are   not same, so they are not anagrams. Your Task: You don't need to read input or print anything. Your task is to complete the function isAnagram() which takes the string a and string b as input parameter and check if the two

Stock buy and sell (DSA)

  Problem Statement :(👈click here for GFG) The cost of stock on each day is given in an array  A [] of size  N . Find all the segments of days on which you buy and sell the stock so that in between those days  for which profit can be generated . Note:   Since there can be multiple solutions ,  the driver code will print 1 if your answer is correct, otherwise, it will return 0. In case there's no profit the driver code will print the string " No Profit " for a correct solution. Example 1: Input: N = 7 A[] = {100,180,260,310,40,535,695} Output: 1 Explanation: One possible solution is (0 3) (4 6) We can buy stock on day 0, and sell it on 3rd day, which will give us maximum profit. Now, we buy stock on day 4 and sell it on day 6. Example 2: Input: N = 5 A[] = {4,2,2,2,4} Output: 1 Explanation: There are multiple possible solutions. one of them is (3 4) We can buy stock on day 3, and sell it on 4th day, which will give us maximum profit. Your Task: The task is to com

BFS of graph (DSA)

  Problem Statement :(👈click here for GFG) Given a directed graph. The task is to do Breadth First Traversal of this graph starting from 0. Note:  One can move from node u to node v only if there's an edge from u to v and find the BFS traversal of the graph starting from the 0th vertex,  from left to right according to the graph. Also, you should only take nodes directly or indirectly connected from Node 0 in consideration. Example 1: Input: Output: 0 1 2 3 4 Explanation : 0 is connected to 1 , 2 , 3. 2 is connected to 4. so starting from 0, it will go to 1 then 2 then 3.After this 2 to 4, thus bfs will be 0 1 2 3 4. Example 2: Input: Output: 0 1 2 Explanation : 0 is connected to 1 , 2. so starting from 0, it will go to 1 then 2, thus bfs will be 0 1 2. Your task: You dont need to read input or print anything. Your task is to complete the function bfsOfGraph() which takes the integer V denoting the number of vertices and adjacency list as input parameters and returns a li

Maximum of all subarrays of size k

  Problem Statement :(👈click here for GFG) Given an array arr[] of size N and an integer K. Find the maximum for each and every contiguous subarray of size K. Example 1: Input: N = 9, K = 3 arr[] = 1 2 3 1 4 5 2 3 6 Output: 3 3 4 5 5 5 6 Explanation: 1st contiguous subarray = {1 2 3} Max = 3 2nd contiguous subarray = {2 3 1} Max = 3 3rd contiguous subarray = {3 1 4} Max = 4 4th contiguous subarray = {1 4 5} Max = 5 5th contiguous subarray = {4 5 2} Max = 5 6th contiguous subarray = {5 2 3} Max = 5 7th contiguous subarray = {2 3 6} Max = 6 Example 2: Input: N = 10, K = 4 arr[] = 8 5 10 7 9 4 15 12 90 13 Output: 10 10 10 15 15 90 90 Explanation: 1st contiguous subarray = {8 5 10 7}, Max = 10 2nd contiguous subarray = {5 10 7 9}, Max = 10 3rd contiguous subarray = {10 7 9 4}, Max = 10 4th contiguous subarray = {7 9 4 15}, Max = 15 5th contiguous subarray = {9 4 15 12}, Max = 15 6th contiguous subarray = {4 15 12 90}, Max = 90 7th contiguous subarray = {15 12 90 13}, Max = 90 Y

Boundary Traversal of binary tree (DSA)

  Problem Statement :(👈click here for GFG) Given a Binary Tree, find its Boundary Traversal. The traversal should be in the following order:  Left boundary nodes:  defined as the path from the root to the left-most node  ie- the leaf node you could reach when you always travel preferring the left subtree over the right subtree.  Leaf nodes:  All the leaf nodes except for the ones that are part of left or right boundary. Reverse right boundary nodes:  defined as the path from the right-most node to the root. The right-most node is the leaf node you could reach when you always travel preferring the right subtree over the left subtree. Exclude the root from this as it was already included in the traversal of left boundary nodes. Note:  If the root doesn't have a left subtree or right subtree, then the root itself is the left or right boundary.  Example 1: Input: 1   / \   2 3     / \ / \   4 5 6 7   / \   8 9 Output: 1 2 4 8 9 6 7 3 Exp

Finding middle element in a linked list (DSA)

  Problem Statement:  (👈click here for GFG) Given a singly linked list of  N  nodes. The task is to find the  middle  of the linked list. For example, if the linked list is 1-> 2->3->4->5 ,   then the middle node of the list is  3 . If there are two middle nodes(in case, when  N  is even), print the  second middle  element. For example, if the linked list given is  1->2->3->4->5->6 , then the middle node of the list is  4 . Example 1: Input: LinkedList: 1->2->3->4->5 Output: 3 Explanation: Middle of linked list is 3. Example 2:  Input: LinkedList: 2->4->6->7->5->1 Output: 7 Explanation: Middle of linked list is 7. Your Task: The task is to complete the function getMiddle() which takes a head reference as the only argument and should return the data at the middle node of the linked list. Expected Time Complexity: O(N). Expected Auxiliary Space: O(1). Constraints: 1 <= N <= 5000 Solution: class Solution { /* Shou

Detect cycle in a directed graph (DSA)

  problem Statement :(👈click here for GFG) Given a Directed Graph with  V  vertices (Numbered from  0  to  V-1 ) and  E  edges, check whether it contains any cycle or not. Example 1: Input: Output: 1 Explanation : 3 -> 3 is a cycle Example 2: Input: Output: 0 Explanation : no cycle in the graph Your task: You dont need to read input or print anything. Your task is to complete the function isCyclic() which takes the integer V denoting the number of vertices and adjacency list as input parameters and returns a boolean value denoting if the given directed graph contains a cycle or not. Expected Time Complexity: O(V + E) Expected Auxiliary Space: O(V) Constraints: 1 ≤ V, E ≤ 10^5 Solution: class Solution { // Function to detect cycle in a directed graph. isCyclic(V, adj) { // Create arrays to keep track of visited nodes and nodes in the current recursion stack. let visited = new Array(V).fill(false); let recStack = new Array(V).fill(false); // Helper fu