• Login
Wednesday, June 25, 2025
Blogue
  • Homepage
  • Affiliates
    Best Sellers in Home at Amazon

    Best Sellers in Home at Amazon

  • Web
    The WordPress Drama- Open Source at War

    The WordPress Drama: Open Source at War

    The Plan to Break Apart Google- RIP Chrome_

    The Plan to Break Apart Google: RIP Chrome?

    Andrew Tate’s Hustler’s University Hacked- What We Know

    Andrew Tate’s Hustler’s University Hacked: What We Know

    Scraping Websites with Various Scraper Frameworks (With Examples)

    Scraping Websites with Various Scraper Frameworks (With Examples)

    Git : Developer’s Favourite

    Git : Developer’s Favourite

    HTTP Status/Error Codes and How to Fix them

    HTTP Status/Error Codes and How to Fix them

    A Walkthrough to Hashing, Salting , and Verifying Passwords in NodeJS, Python, Golang, and Java

    A Walkthrough to Hashing, Salting , and Verifying Passwords in NodeJS, Python, Golang, and Java

    Guide to Googling

    Guide to Googling

    How To Submit a Form With Puppeteer and JavaScript

    How To Submit a Form With Puppeteer and JavaScript

  • Web Developer
    How to Detect Ad Blockers in a React.js Application

    How to Detect Ad Blockers in a React.js Application

    How to Create Responsive Image in CSS

    How to Create Responsive Image in CSS

    A Walkthrough to Hashing, Salting , and Verifying Passwords in NodeJS, Python, Golang, and Java

    A Walkthrough to Hashing, Salting , and Verifying Passwords in NodeJS, Python, Golang, and Java

    How To Take Screenshot With Puppeteer

    How To Take Screenshot With Puppeteer

    Web Scraping With JavaScript and Puppeteer

    Web Scraping With JavaScript and Puppeteer

    How to create a Responsive Website

    How to create a Responsive Website

    Top Frontend Frameworks To Learn

    Top Frontend Frameworks To Learn

    Full Stack Web Developer: A Guide to Learn

    Full Stack Web Developer: A Guide to Learn

  • Web Scraping
    Scraping Websites with Various Scraper Frameworks (With Examples)

    Scraping Websites with Various Scraper Frameworks (With Examples)

    Scraping Table Data into JSON File with Puppeteer

    Scraping Table Data into JSON File with Puppeteer

    How To Scrape Multiple Pages With Puppeteer and JavaScript

    How To Scrape Multiple Pages With Puppeteer and JavaScript

    How To Submit a Form With Puppeteer and JavaScript

    How To Submit a Form With Puppeteer and JavaScript

    How to Automate Form Submission with Puppeteer and Javascript

    How to Automate Form Submission with Puppeteer and Javascript

    How To Take Screenshot With Puppeteer

    How To Take Screenshot With Puppeteer

    Web Scraping With JavaScript and Puppeteer

    Web Scraping With JavaScript and Puppeteer

  • How To?
    How LinkedIn Powers Professional Networking: A Look Inside Its System Design

    How LinkedIn Powers Professional Networking: A Look Inside Its System Design

    Facebook: The Engine Behind the World’s Largest Social Network

    Facebook: The Engine Behind the World’s Largest Social Network

    Snapchat: The System Powering Snaps, Stories, and Lenses

    Snapchat: The System Powering Snaps, Stories, and Lenses

    How WhatsApp Powers Instant Communication for Billions

    How WhatsApp Powers Instant Communication for Billions?

    How Instagram Scales to Billions of Photos and Videos Daily

    How Instagram Scales to Billions of Photos and Videos Daily?

    How Netflix Delivers High-Quality Streaming to Millions Worldwide

    How Netflix Delivers High-Quality Streaming to Millions Worldwide

    Effective Structure for Describe Image, Retell Lecture, and Summarize Spoken Text in PTE Academic

    Effective Structure for Describe Image, Retell Lecture, and Summarize Spoken Text in PTE Academic

    Understanding Marks Allocation in PTE Academic Tasks

    Understanding Marks Allocation in PTE Academic Tasks

    From Power-On to Productivity: How Your Operating System Comes to Life

    From Power-On to Productivity: How Your Operating System Comes to Life

  • Technology
    A Deep Dive into Physical Storage Devices: From Floppy Disks to Modern SSDs

    A Deep Dive into Physical Storage Devices: From Floppy Disks to Modern SSDs

    How Netflix Delivers High-Quality Streaming to Millions Worldwide

    How Netflix Delivers High-Quality Streaming to Millions Worldwide

    The WordPress Drama- Open Source at War

    The WordPress Drama: Open Source at War

    25 Software Bugs That Changed the World

    25 Software Bugs That Changed the World

    The Plan to Break Apart Google- RIP Chrome_

    The Plan to Break Apart Google: RIP Chrome?

    Guide to Googling

    Guide to Googling

    How Video Streaming on the Internet Works

    How Video Streaming on the Internet Works

    Git : A short history

    Git : A short history

    A Walkthrough to Blockchain

    A Walkthrough to Blockchain

  • System Design
    How LinkedIn Powers Professional Networking: A Look Inside Its System Design

    How LinkedIn Powers Professional Networking: A Look Inside Its System Design

    Facebook: The Engine Behind the World’s Largest Social Network

    Facebook: The Engine Behind the World’s Largest Social Network

    Snapchat: The System Powering Snaps, Stories, and Lenses

    Snapchat: The System Powering Snaps, Stories, and Lenses

    How WhatsApp Powers Instant Communication for Billions

    How WhatsApp Powers Instant Communication for Billions?

    How Instagram Scales to Billions of Photos and Videos Daily

    How Instagram Scales to Billions of Photos and Videos Daily?

    How Netflix Delivers High-Quality Streaming to Millions Worldwide

    How Netflix Delivers High-Quality Streaming to Millions Worldwide

    How YouTube Handles Billions of Videos Daily

    How YouTube Handles Billions of Videos Daily?

    How Spotify Streams Personalized Music to Millions in Real-Time?

    How Spotify Streams Personalized Music to Millions in Real-Time?

Submit Post
No Result
View All Result
  • Homepage
  • Affiliates
    Best Sellers in Home at Amazon

    Best Sellers in Home at Amazon

  • Web
    The WordPress Drama- Open Source at War

    The WordPress Drama: Open Source at War

    The Plan to Break Apart Google- RIP Chrome_

    The Plan to Break Apart Google: RIP Chrome?

    Andrew Tate’s Hustler’s University Hacked- What We Know

    Andrew Tate’s Hustler’s University Hacked: What We Know

    Scraping Websites with Various Scraper Frameworks (With Examples)

    Scraping Websites with Various Scraper Frameworks (With Examples)

    Git : Developer’s Favourite

    Git : Developer’s Favourite

    HTTP Status/Error Codes and How to Fix them

    HTTP Status/Error Codes and How to Fix them

    A Walkthrough to Hashing, Salting , and Verifying Passwords in NodeJS, Python, Golang, and Java

    A Walkthrough to Hashing, Salting , and Verifying Passwords in NodeJS, Python, Golang, and Java

    Guide to Googling

    Guide to Googling

    How To Submit a Form With Puppeteer and JavaScript

    How To Submit a Form With Puppeteer and JavaScript

  • Web Developer
    How to Detect Ad Blockers in a React.js Application

    How to Detect Ad Blockers in a React.js Application

    How to Create Responsive Image in CSS

    How to Create Responsive Image in CSS

    A Walkthrough to Hashing, Salting , and Verifying Passwords in NodeJS, Python, Golang, and Java

    A Walkthrough to Hashing, Salting , and Verifying Passwords in NodeJS, Python, Golang, and Java

    How To Take Screenshot With Puppeteer

    How To Take Screenshot With Puppeteer

    Web Scraping With JavaScript and Puppeteer

    Web Scraping With JavaScript and Puppeteer

    How to create a Responsive Website

    How to create a Responsive Website

    Top Frontend Frameworks To Learn

    Top Frontend Frameworks To Learn

    Full Stack Web Developer: A Guide to Learn

    Full Stack Web Developer: A Guide to Learn

  • Web Scraping
    Scraping Websites with Various Scraper Frameworks (With Examples)

    Scraping Websites with Various Scraper Frameworks (With Examples)

    Scraping Table Data into JSON File with Puppeteer

    Scraping Table Data into JSON File with Puppeteer

    How To Scrape Multiple Pages With Puppeteer and JavaScript

    How To Scrape Multiple Pages With Puppeteer and JavaScript

    How To Submit a Form With Puppeteer and JavaScript

    How To Submit a Form With Puppeteer and JavaScript

    How to Automate Form Submission with Puppeteer and Javascript

    How to Automate Form Submission with Puppeteer and Javascript

    How To Take Screenshot With Puppeteer

    How To Take Screenshot With Puppeteer

    Web Scraping With JavaScript and Puppeteer

    Web Scraping With JavaScript and Puppeteer

  • How To?
    How LinkedIn Powers Professional Networking: A Look Inside Its System Design

    How LinkedIn Powers Professional Networking: A Look Inside Its System Design

    Facebook: The Engine Behind the World’s Largest Social Network

    Facebook: The Engine Behind the World’s Largest Social Network

    Snapchat: The System Powering Snaps, Stories, and Lenses

    Snapchat: The System Powering Snaps, Stories, and Lenses

    How WhatsApp Powers Instant Communication for Billions

    How WhatsApp Powers Instant Communication for Billions?

    How Instagram Scales to Billions of Photos and Videos Daily

    How Instagram Scales to Billions of Photos and Videos Daily?

    How Netflix Delivers High-Quality Streaming to Millions Worldwide

    How Netflix Delivers High-Quality Streaming to Millions Worldwide

    Effective Structure for Describe Image, Retell Lecture, and Summarize Spoken Text in PTE Academic

    Effective Structure for Describe Image, Retell Lecture, and Summarize Spoken Text in PTE Academic

    Understanding Marks Allocation in PTE Academic Tasks

    Understanding Marks Allocation in PTE Academic Tasks

    From Power-On to Productivity: How Your Operating System Comes to Life

    From Power-On to Productivity: How Your Operating System Comes to Life

  • Technology
    A Deep Dive into Physical Storage Devices: From Floppy Disks to Modern SSDs

    A Deep Dive into Physical Storage Devices: From Floppy Disks to Modern SSDs

    How Netflix Delivers High-Quality Streaming to Millions Worldwide

    How Netflix Delivers High-Quality Streaming to Millions Worldwide

    The WordPress Drama- Open Source at War

    The WordPress Drama: Open Source at War

    25 Software Bugs That Changed the World

    25 Software Bugs That Changed the World

    The Plan to Break Apart Google- RIP Chrome_

    The Plan to Break Apart Google: RIP Chrome?

    Guide to Googling

    Guide to Googling

    How Video Streaming on the Internet Works

    How Video Streaming on the Internet Works

    Git : A short history

    Git : A short history

    A Walkthrough to Blockchain

    A Walkthrough to Blockchain

  • System Design
    How LinkedIn Powers Professional Networking: A Look Inside Its System Design

    How LinkedIn Powers Professional Networking: A Look Inside Its System Design

    Facebook: The Engine Behind the World’s Largest Social Network

    Facebook: The Engine Behind the World’s Largest Social Network

    Snapchat: The System Powering Snaps, Stories, and Lenses

    Snapchat: The System Powering Snaps, Stories, and Lenses

    How WhatsApp Powers Instant Communication for Billions

    How WhatsApp Powers Instant Communication for Billions?

    How Instagram Scales to Billions of Photos and Videos Daily

    How Instagram Scales to Billions of Photos and Videos Daily?

    How Netflix Delivers High-Quality Streaming to Millions Worldwide

    How Netflix Delivers High-Quality Streaming to Millions Worldwide

    How YouTube Handles Billions of Videos Daily

    How YouTube Handles Billions of Videos Daily?

    How Spotify Streams Personalized Music to Millions in Real-Time?

    How Spotify Streams Personalized Music to Millions in Real-Time?

Submit Post
No Result
View All Result
Blogue
  • Homepage
  • Affiliates
  • Web
  • Web Developer
  • Web Scraping
  • How To?
  • Technology
  • System Design

How to code?

The Blogue Team by The Blogue Team
September 14, 2024
in Algorithm, Coding, ES6, How To?, JavaScript, Programming, Skills, Tutorial
Reading Time: 5 mins read
309
A A
0
319
SHARES
1.1k
VIEWS
Share on FacebookShare on XShare on RedditShare on Whatsapp

Every programming problem involves some kind of algorithm. Algorithm is a process or set of steps to accomplish a certain tasks or a step by step way to solve a problem. There are about 700 programming languages. Here is a list. So what to learn and why to learn that’s most of the people stuck on. In my perspective You can learn any. Learning basics of some on-demand programming language is not a harm. But you must select a language that becomes your magic spell and you should always be ready to create something out of it. Learning varieties of languages and not being able to do anything is like a curse. So,that’s all about leaning and selecting.Now I will mention the steps which I follow to solve a problem. I have broken it into 5 steps. Here I go then.

  • Understand the problem
  • Explore Examples
  • Break it Down
  • Solve / Simplify
  • Look Back and Refactor

Let’s look the steps into more detail with examples. As I am deeply in love with JavaScript I will be using that. Feel free to use your own magic spell.

Example question: Count the value of only numbers and alphabets from a given string “Hello There Blogue IS A BEauTIFUL %^$##@123451112231144 !!!!!$%#”

1. Understand the problem

  • Can I restate the problem in own word?
  • What are the inputs that go into the problem?
  • What are the outputs that should come from the solution to the problem?
  • Can the outputs be determined from the input?
  • Do I have enough information to solve the problem?
  • How should I label the important pieces of data that are a part of the problem?
Input:
integer?
float?
string?
str("Hello There Blogue IS A BEauTIFUL %^$##@123451112231144 !!!!!$%#")
Output:
integer?
float?
string?
result: { h: 2, e: 3, l: 2, o: 2, t: 1, r: 1, f: 1, u: 2, c: 1, k: 1, y: 1 }

2. Explore Examples

  • Which can help understand the problem better.
  • Provides sanity checks that your eventual solution works how it should.
  • Start with simple examples.
  • Move to complex example.
  • Explore examples with empty inputs.
  • Explore examples with Invalid inputs.
//example1
let str = '';


for (let i = 0; i < 9; i++) {
  str = str + i;
}
console.log(str);

//example2
const sentence = 'The quick brown fox jumps over the lazy dog.';

console.log(sentence.toLowerCase());

//example3
function testNum(a) {
  let result;
  if (a > 0) {
    result = 'positive';
  } else {
    result = 'NOT positive';
  }
  return result;
}

3.Break it Down

  • Explicitly write out the steps you need to take.
  • Comment out steps to be used
function countValues(str){
                                   var result = {};
                                  for(var i=0;i<str.length;i++)
                                 {
                                   var chara = str[i].toLowerCase();
     //conversion of string to lowercase as the same letter is in small and in capital,we don' want thatif(result[chara]>0){   
                                            result[chara]++;
     //increments the count if condition is grater than 0;
                                           }else{
     //else makes it 1
                                                  result[chara] = 1;
                                           }
                                           }
        }
                                           console.log(result) ;
        }
countValues("Hello There Blogue IS A BEauTIFUL %^$##@123451112231144 !!!!!$%#") 

We are near to the solution but its not totally correct. We still need to eliminate the spaces and the symbols.

4.Solve / Simplify

  • Solve a simpler problem.
  • Find the core difficulty in what you are trying to do.
  • Temporarily skip the difficulty.
  • Write a simplified solution.
  • Then incorporate that difficulty back in the code.
function countValues(str){
                                   var result = {};
                                   //for(var i=0;i<str.length;i++)for(var chara of str)
                                   {
                                   //var chara = str[i].toLowerCase();
                                   chara = chara.toLowerCase();
                                   
                                   //R.E to check lowercase and numberif(/[a-z0-9]/.test(chara)){
                                   result[chara] = ++result[chara] || 1;
                                   
                                   // if(result[chara]>0){
                                   
                                   // result[chara]++;// }else{//                   result[chara] = 1;// }
                                   }
}
                                   console.log(result) ;
}
countValues("Hello There Blogue IS A BEauTIFUL %^$##@123451112231144 !!!!!$%#") 

Now our solution is complete. But In real life application we check the speed of the approach,how fast the code executes to give output.So, we follow step 5.

5.Look Back and Refactor

  • Can you derive the result differently?
  • Can you understand it at a glance?
  • Can you use the result or method for other problem?
  • Can you improve the performance of your solution?
  • Can you think of other ways to refactor the code?
  • How have other people solved the same problem?
function countValues(str){
                                   var result = {};
                                   for(var chara of str){
                                   
                                   if(isAlphaNumeric(chara)){
                                   chara = chara.toLowerCase();
                                   result[chara] = ++result[chara] || 1;
}
}
console.log(result) ;
}


function isAlphaNumeric(chara){
                                   var code = chara.charCodeAt(0);
if(!(code > 47 && code < 58)&& !(code > 64 && code < 91)&& !(code > 96 && code < 123))
{
return false; 
}
return true;
}
countValues("Hello There Blogue IS A BEauTIFUL %^$##@123451112231144 !!!!!$%#")

When we compare the speed of the code in step 4 (55% slower) . This code is pretty much faster in execution.

That’s all I do for solving problems .Different people have their own perspective. You can try these steps and see the result.

Learn, Code , Create repeat…..(^ _ ^)

Tags: CallbacksCodingProgrammingPromise
Share128Tweet80ShareSend
Previous Post

Error Handling in Javascript

Next Post

Github Student Pack and How to get it?

The Blogue Team

The Blogue Team

We are a team of passionate bloggers

Related Posts

How LinkedIn Powers Professional Networking: A Look Inside Its System Design
How To?

How LinkedIn Powers Professional Networking: A Look Inside Its System Design

by The Blogue Team
December 18, 2024
1.2k
A Deep Dive into Physical Storage Devices: From Floppy Disks to Modern SSDs
Storage

A Deep Dive into Physical Storage Devices: From Floppy Disks to Modern SSDs

by The Blogue Team
December 17, 2024
1.1k
Facebook: The Engine Behind the World’s Largest Social Network
Facebook

Facebook: The Engine Behind the World’s Largest Social Network

by The Blogue Team
December 17, 2024
1.1k
Load More
Next Post
Github Student Pack and How to get it?

Github Student Pack and How to get it?

Where Writing Happens

  • Homepage
  • About Us
  • Contact Us
  • Privacy Policy
  • Terms & Conditions
  • Sitemap

© 2025 Blogue - Designed By Najus Digital.

Welcome Back!

Sign In with Google
OR

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Refresh
No Result
View All Result
  • Login

© 2025 Blogue - Designed By Najus Digital.

*By registering into our website, you agree to the Terms & Conditions. and Privacy Policy.
Enable Notifications OK No thanks