AI robot coding

Sep 1, 2023

Sep 1, 2023

Sep 1, 2023

Will AI Replace Programmers? - 3 Coding Challenges

Will AI Replace Programmers? - 3 Coding Challenges

Will AI Replace Software Developers?

Intro

This blog post continues our experiments with Generative AI for writing SQL and coding. The first experiment showed outstanding results for SQL writing. Text-To-SQL feature created correct answers for Leetcode's SQL Challenges. More details are in the original Blogspot.

So Will AI replace software developers? To answer the question, let's do the very same experiment. I will solve LeetCode challenges with AI for coding and see if my results will be correct. 

Why use Metatable.ai Instead of ChatGPT or Github Copilot?

Before diving into LeetCode's Challenges, you may ask questions like:

  1. Is Metatable better than ChatGPT or GitHub Copilot? 

  2. What are the benefits of using Metatable.ai?


TLDR: Image from Tweet by 0xgaut

GPT gives code - where do I put code though?

The differences between Metatable vs. ChatGPT vs. GitHub Copilot: 

  1. Instant building and deployment. Metatable.ai can compile and deploy code. If you want to build and deploy software applications, Metatable would be the most accessible platform to do so. You won't find such with Github Copilot or ChatGPT, where AI generates code, and then you have to run it somewhere, validate for errors, and bring it back to AI for fixing or changes. At metatable.ai, you do it in seconds under the same platform.  

  2. Better UX. With ChatGPT, you must do 'prompt engineering' to prepare enough context for the model to write proper code. Metatable provides the full context of your project, including the database schema, existing codebase, and your project description. 

Recently we announced a Full AI setup where you describe your project in simple language and Metatable designs and build a backend including a database and five endpoints. Check out a detailed blog post for a Full AI setup. 

So Metatable is the ultimate software development platform. With Metatable.ai you don't have to worry about any environment or infrastructure setup. ChatGPT or Github Copilot provides just code that needs to be run somewhere. 

Text to Code with Metatable.ai

Methodology of Generation Code with AI

So let's dive into the coding challenges at LeetCode. Metatable writes code with Rust language, so I will choose only those challenges with Rust implementation. 

Why Rust? - because it is officially the most-loved language seven years in a row. But not only because of that, there will be a separate post on Metatable's technology stack.

To solve the challenges using Metatable.ai, I will follow these steps:

  1. Inside Metatable.ai, I will create a new function for each Challenge. 

  2. I will use the Leetcode's Challenge description as a prompt to generate code with AI. Then I will copy and paste the generated code from Metatable's interface back into the LeetCode's Challenge interface. 

Now let's go! 

Challenge 1 - Easy task: Two Sum

Step 1. Creating function two_sum

Step 2. Copy task description from LeetCode and paste into the function, so that AI is able to code the solution.

Note that I added into the prompt how we want AI to code the solution:

impl Solution { pub fn two_sum(nums: Vec<i32>, target: i32) -> Vec<i32> { }}

When AI generated the code I just copied all within impl Solution

The code wiritten by AI beats 83% of users who used Rust. Good result.

However, memory use was sub-optimal, only beating 5.98% of users.

Challenge 1: screenshot from LeetCode showing Resutlts by AI coding

Challenge 2 - Medium task: Add Two Numbers

You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.

You may assume the two numbers do not contain any leading zero, except the number 0 itself.

Challenge 2 - Medium task: Add Two Numbers

I copied this text and put it into Metatable's chat with AI. Note that in order to be accepted at Leetcode I needed the solution to be wrapped into:

impl Solution {pub fn add_two_numbers(l1: Option<Box<ListNode>>, l2: Option<Box<ListNode>>) -> Option<Box<ListNode>> }

Screenshot from Metatable.AI showing AI chat

Here is where interesting things started to happen. So I created a new function at metatable.ai, and copied leetcode’s description into the chat with AI asking it to write code in Rust.
So what happened:

  1. The model wrote a code which was accepted by leetcode and beat 71.47% in terms of runtime (3 ms) and 2.04 memory use beating 93.73% of users with Rust.

    Challenge 2: screenshot from LeetCode showing Resutlts by AI coding
  2. Due to Metatable’s prompt pipeline and infrastructure configuration the solution was put into the endpoint and deployed to the web server. So it is available online and solves the problem via API 🙂. So not only it was able to solve the challenge, it also created an Endpoint with the solution!

    You can check this API by sending POST request with this
    curl -X POST https://bn6jt9dpjfncfhlhf0lw.metatable.ai/addtwonumbers -H 'Content-Type: application/json' -d '{"l1": [2,4,3], "l2": [5,6,4]}' In return you'll get the result:

    [7,0,8]

Challenge 3 - Hard task: Median of Two Sorted Arrays

Let’s try a hard task and see AI could write code for it. So I'm doing the same things:

  1. Creating function named median_of_two_arrays

  2. Pasting task description to chat with AI.

I added a Short demo of how AI solves Leetcode's Hard Coding Challenge.


The result beats 100% of users by Runtime (0ms) and 84.52% users by Memory (2.06 Mb).

Challenge 3: screenshot from LeetCode showing Resutlts by AI coding

Again Metatable.ai not only coded the solution, but it also built it and deployed to the sever. All with one single prompt of LeetCode's task desctipion.


I've published the project with all 3 functions to Metatable's community, so you could check the code.

Conclusions:

  1. I tried three coding challenges at Leetcode using Metatable's code with AI feature.

  2. All three coding challenges were succuessuly complete with above average scores.

  3. I simply copied and pasted task description with mininum intrustion like put impl Solution so it's accepted by Leetcode.

Metatable.ai's AI assistance is truly impressive. I think it complements developers rather than replacing them.

Instead of fearing job displacement, we should embrace the enhancement it offers. Metatable.ai empowers developers to code more efficiently, saving time and effort. It streamlines complex coding tasks, leaving the creative and analytical aspects to the human mind.

We aren't looking at a bleak future where AI replaces the human coder. Rather, we're witnessing the advent of smarter, more efficient coding, where the developer and Artificial Intelligence walk hand in hand.

In a nutshell, with Metatable.ai, we are not just selling a product; we are selling a vision of coding enhanced with AI a smarter, more dynamic way to navigate the coding world.

The future of coding is here, and it's smarter than ever. So, dive in, explore, and embrace the redefined coding experience that Metatable.ai brings to your fingertips.

So, are you ready to give your ideas wings? Sign up for early beta at beta.metatable.ai. and enjoy developing with AI at turbo speed!

TAGS

Will AI Replace Programmers? - 3 Coding Challenges

AI robot coding

Written by

Written by

Written by

Will AI Replace Programmers? - 3 Coding Challenges

Follow us

Follow us

Follow us

Start Building with AI Now

Join 50+ forward-thinking companies already using Metatable.ai

Start Building with AI Now

Join 50+ forward-thinking companies already using Metatable.ai

Start Building with AI Now

Join 50+ forward-thinking companies already using Metatable.ai