Ai Coding Tools

How to Use GitHub Copilot to Write Your First Algorithm in 1 Hour

By BTW Team3 min read

How to Use GitHub Copilot to Write Your First Algorithm in 2026

If you’re a coding newbie, the thought of writing your first algorithm can feel overwhelming. Maybe you've tried coding before but hit a wall, or perhaps you're just diving into programming for the first time. The good news? GitHub Copilot can be a powerful ally in this journey. In just about an hour, you can leverage Copilot to help you craft your very first algorithm with minimal fuss.

Time Estimate: 1 Hour

You can finish this in about one hour if you follow the steps closely and have everything set up beforehand.

Prerequisites

  1. GitHub Account: You’ll need a GitHub account to access Copilot.
  2. Visual Studio Code: Install VS Code as your code editor.
  3. GitHub Copilot Subscription: Copilot costs $10/month for individuals, which is worth it for the productivity boost it offers.

Step-by-Step Guide to Writing Your First Algorithm

Step 1: Set Up Your Environment

  1. Install VS Code: Download and install Visual Studio Code from here.
  2. Install GitHub Copilot Extension: Open VS Code, go to Extensions (Ctrl+Shift+X), and search for "GitHub Copilot." Click "Install."
  3. Sign In to GitHub: Once installed, you'll be prompted to sign in to your GitHub account. Follow the instructions to authenticate.

Step 2: Create a New File

  1. Open a New File: In VS Code, create a new file with a .js or .py extension, depending on your preferred programming language.
  2. Write a Comment: Start with a comment describing what you want to do. For example, type // Write a function to find the maximum number in an array or # Function to find the maximum number in a list.

Step 3: Let Copilot Work Its Magic

  1. Trigger Copilot: After writing the comment, hit Enter. Copilot will automatically suggest a function.
  2. Review and Accept: If you like the suggestion, press Tab to accept it. If it’s not quite right, you can keep typing or ask for another suggestion by pressing Ctrl+Space.

Step 4: Test Your Algorithm

  1. Add Test Cases: Below the function, write a few test cases to see if your function works as expected. For example:
    console.log(findMax([1, 3, 2])); // should return 3
    console.log(findMax([-1, -3, -2])); // should return -1
    
  2. Run the Code: Use the terminal in VS Code to run your code and check the output.

Step 5: Troubleshooting

  • Common Issues: If the function doesn't return the expected output, double-check the logic in the algorithm. You can ask Copilot for help by modifying your comment or writing a new one.
  • What Could Go Wrong: Sometimes, Copilot may suggest incomplete or incorrect code. Always test and validate the suggestions.

What’s Next?

Once you’ve successfully written your first algorithm, consider exploring more complex algorithms, such as sorting or searching algorithms. You can also dive into data structures like arrays and linked lists.

Additional Resources

  • GitHub Copilot Documentation: To get the most out of Copilot, check the official documentation.
  • Built This Week Podcast: For more coding tips and tools, listen to our episodes where we share insights on building with GitHub Copilot and other tools.

Conclusion: Get Started with GitHub Copilot

If you're ready to tackle your first algorithm, start by following the steps above. GitHub Copilot can significantly reduce the friction of coding for beginners.

Recommendation: Sign up for GitHub Copilot, set up your environment, and write your first algorithm today.

Follow Our Building Journey

Weekly podcast episodes on tools we're testing, products we're shipping, and lessons from building in public.

Subscribe

Never miss an episode

Subscribe to Built This Week for weekly insights on AI tools, product building, and startup lessons from Ryz Labs.

Subscribe
Ai Coding Tools

5 Common Mistakes Developers Make When Using AI Coding Tools in 2026

5 Common Mistakes Developers Make When Using AI Coding Tools in 2026 As AI coding tools have become an integral part of a developer's toolkit in 2026, many are still stumbling over

Oct 12, 20264 min read
Ai Coding Tools

5 Myths About AI Coding Tools: What Every Developer Should Know in 2026

5 Myths About AI Coding Tools: What Every Developer Should Know in 2026 As we dive into 2026, the landscape of AI coding tools has evolved significantly, yet many developers still

Oct 11, 20263 min read
Ai Coding Tools

Why AI Coding Assistants Are Overrated for Beginners in 2026

Why AI Coding Assistants Are Overrated for Beginners in 2026 As a solo founder or indie hacker, it’s tempting to think that AI coding assistants are the silver bullet to jumpstart

Oct 10, 20263 min read
Ai Coding Tools

10 Common Mistakes When Using AI Coding Tools for Beginners

10 Common Mistakes When Using AI Coding Tools for Beginners As a beginner in coding, diving into AI coding tools can feel like a doubleedged sword. On one hand, these tools promise

Oct 8, 20264 min read
Ai Coding Tools

5 Common Misconceptions About AI Coding Tools and Why They Hold You Back

5 Common Misconceptions About AI Coding Tools and Why They Hold You Back As a solo founder or indie hacker, you might be considering leveraging AI coding tools to boost your produc

Oct 7, 20264 min read
Ai Coding Tools

5 Common Misconceptions About AI Coding Tools That Will Hurt Your Learning

5 Common Misconceptions About AI Coding Tools That Will Hurt Your Learning As a beginner in coding, diving into the world of AI coding tools can feel like stepping into a futuristi

Oct 6, 20263 min read