Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,208,816 members, 8,003,879 topics. Date: Friday, 15 November 2024 at 09:55 PM

Let us see the real programmers. Not Every Time Here Frontend, Backend, React. - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Let us see the real programmers. Not Every Time Here Frontend, Backend, React. (1171 Views)

Let's See The Real Programmers Here / Why Are Backend Developers Paid More Than Frontend Developers? / Why Are The Best Programmers Not Found? (2) (3) (4)

(1) (2) (Reply) (Go Down)

Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by turmacs(f): 6:02pm On Jun 12
You can attempt the problem with any language you are comfortable with.

Problem statement
you are given an n by m grid (n is the number of rows and m is the number of columns), the grid only contains just the characters '*' and '#', a whole manhattan circle exit's on the grid. The coordinates of the top left corner and bottom right corner of this grid are (1,1) and (n,m) respectively.

The point (a,b) is a part of the manhattan circle which is centered at (h,k) if | h - a | + | k - b | < r , where r is a positive constant and | x - y | represents the absolute value of x - y.

On this grid, all points that are a part of the manhattan circle are denoted by the '#' character. Your task is to find the coordinates of the circles center.

Input
The first line contains t ( 1 <= t <= 1000) --- The number of testcases.
The first line of each testcase contain n and m (1 <= n *m <= 2*105) which both stand for the height and width of the grid respectively.

The next n lines contain m characters that are either '.' or '#'. If the character is '#', then you know that the point is a part of the circle.

Output
For each t, your code has to print two integers, the coordinates of the circles center.


Example
Input
6
5 5
*****
*****
**#**
*****
*****
5 5
**#**
*###*
#####
*###*
**#**
5 6
******
******
*#****
###***
*#****
1 1
#
5 6
***#**
**###*
*#####
**###*
***#**
2 10
**********
***#******

Output
3 3
3 3
4 2
1 1
3 4
2 4



Let us see those that are real programmers smiley

nlfpmod mynd44 farano dominique, is this fun enough for front page?
Re: Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by RealLordZeus(m): 6:09pm On Jun 12
I no get strength to attempt without money grin grin
Re: Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by turmacs(f): 6:50pm On Jun 12
RealLordZeus:
I no get strength to attempt without money grin grin
na so, just say you can't solve it, nobody will mock you.
Re: Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by RealLordZeus(m): 6:52pm On Jun 12
turmacs:
na so, just say you can't solve it, nobody will mock you.
yes you are right
Re: Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by airsaylongcome: 8:30pm On Jun 12
OP, you know that there's AI that can write fully functional code that solves this. I Just threw it at my "weak" self hosted LLM and it has churned out Python and C++ code that look workable

1 Like

Re: Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by turmacs(f): 8:47pm On Jun 12
airsaylongcome:
OP, you know that there's AI that can write fully functional code that solves this. I Just threw it at my "weak" self hosted LLM and it has churned out Python and C++ code that look workable
Lolzzz.. Except your "LLM" or "AI" is better than chatgpt, i don't think it can solve this one because chatgpt could not solve it. No be by cho , cho , cho, show workings grin Post the solution here let us see it.
Re: Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by Adonisty: 8:58pm On Jun 12
turmacs:
na so, just say you can't solve it, nobody will mock you.
is this a new avatar of Devdevdev? Sounded like a female version of Tastedfriedpussy
Re: Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by PulsingPurple(m): 9:41pm On Jun 12
Sorry I'm trying to edit this post but Nairaland and their Cloudflare keeps rejecting
Re: Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by PulsingPurple(m): 9:42pm On Jun 12
Re: Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by PulsingPurple(m): 10:27pm On Jun 12
turmacs:
Lolzzz.. Except your "LLM" or "AI" is better than chatgpt, i don't think it can solve this one because chatgpt could not solve it. No be by cho , cho , cho, show workings grin Post the solution here let us see it.

Hope Cloudflare finally allows me to post 😑

This is the updated response from Google's Gemini Advanced

After getting the first code which I've removed, I tried to run it but it didn't run, so the AI debugged the code till it eventually ran...

2 Likes

Re: Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by turmacs(f): 10:36pm On Jun 12
PulsingPurple:


Hope Cloudflare finally allows me to post 😑

This is the updated response from Google's Gemini Advanced

After getting the first code which I've removed, I tried to run it but it didn't run, so the AI debugged the code till it eventually ran...
Wow this is actually correct and I am really surprised that it could solve it (although this a very easy problem). Chatgpt just solved nonsense. So no software engineer on NL could solve this till now? wonderfull.
Re: Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by airsaylongcome: 10:46pm On Jun 12
turmacs:
Lolzzz.. Except your "LLM" or "AI" is better than chatgpt, i don't think it can solve this one because chatgpt could not solve it. No be by cho , cho , cho, show workings grin Post the solution here let us see it.


#include <iostream>
#include <vector>

using namespace std;

pair<int, int> findCircleCenter(int n, int m, vector<string>& grid) {
int rowSum = 0, colSum = 0, count = 0;

for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
if (grid[i][j] == '#') {
rowSum += i + 1;
colSum += j + 1;
count++;
}
}
}

int centerRow = (rowSum + count - 1) / count;
int centerCol = (colSum + count - 1) / count;

return make_pair(centerRow, centerCol);
}

int main() {
int t;
cout << "Enter the number of test cases: ";
cin >> t;

while (t--) {
int n, m;
cout << "Enter the dimensions of the grid (n m): ";
cin >> n >> m;

vector<string> grid(n);
cout << "Enter the grid (each row on a new line):\n";
for (int i = 0; i < n; ++i) {
cin >> grid[i];
}

pair<int, int> center = findCircleCenter(n, m, grid);

cout << "Center of the circle: " << center.first << " " << center.second << endl;
}

return 0;
}

1 Like

Re: Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by PulsingPurple(m): 10:47pm On Jun 12
turmacs:
Wow this is actually correct and I am really surprised that it could solve it (although this a very easy problem). Chatgpt just solved nonsense. So no software engineer on NL could solve this till now? wonderfull.

I heard ChatGPT is better than Gemini...
It would have probably debugged it's error code if you kept on directing it...

The developers here are probably tired
Let AI assist them 😅
Re: Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by airsaylongcome: 10:57pm On Jun 12
PulsingPurple:


I heard ChatGPT is better than Gemini...
It would have probably debugged it's error code if you kept on directing it...

The developers here are probably tired
Let AI assist them 😅

I'm surprised they earlier said ChatGPT couldn't solve it. Just running llama3 on a Raspberry pi could churn out correct code in different languages. Let alone throwing the compute power of ChatGPT. OP needs to learn Prompt Engineering

PS: Just realized how old school I am. I'm only comfortable with C++ or Java source code
Re: Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by PulsingPurple(m): 11:07pm On Jun 12
airsaylongcome:


I'm surprised they earlier said ChatGPT couldn't solve it. Just running llama3 on a Raspberry pi could churn out correct code in different languages. Let alone throwing the compute power of ChatGPT. OP needs to learn Prompt Engineering

PS: Just realized how old school I am. I'm only comfortable with C++ or Java source code

Prompt Engineering sounds like one of those complex grammar people choose to use for simple matters, everyone should just be aware of how to force the AI to spew desired info (lol).
...

Right now I'm more concerned with the thought that you have a Raspberry Pi, and that it runs your own isolated LLM... Is this what techies do with their free time? I thought it'll be only Americans...

Have you heard of ChatBawa the Nigerian LLM... (it's a failed project currently)
You may want to join their team 🙂
Re: Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by airsaylongcome: 11:16pm On Jun 12
PulsingPurple:


Prompt Engineering sounds like one of those complex grammar people choose to use for simple matters, everyone should just be aware of how to force the AI to spew desired info (lol).
...

Right now I'm more concerned with the thought that you have a Raspberry Pi, and that it runs your own isolated LLM... Is this what techies do with their free time? I thought it'll be only Americans...

Have you heard of ChatBawa the Nigerian LLM... (it's a failed project currently)
You may want to join their team 🙂

I no dey join any Nigerian blah blah blah...our matter too dey get problem.

Regarding the Pi, it's not running a self built LLM o. It's Ollama with llama3 model. I'm trying to train it to see where I get...yes there are some airheads like us who consider this as "free time toy".

Prompt Engineering is actually developing into a Career! Seen some $50/hr job postings around it. And yes, it is big grammar for the prompt you provide the AI
Re: Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by PulsingPurple(m): 11:53pm On Jun 12
airsaylongcome:


I no dey join any Nigerian blah blah blah...our matter too dey get problem.


Na play oo 😂



Regarding the Pi, it's not running a self built LLM o. It's Ollama with llama3 model. I'm trying to train it to see where I get...yes there are some airheads like us who consider this as "free time toy".

Prompt Engineering is actually developing into a Career! Seen some $50/hr job postings around it. And yes, it is big grammar for the prompt you provide the AI

Yh I know it's not self trained... Shebi it's Llama3 na... It's just this Pi stuff
Just like Indian techies will buy Arduino and program small gadgets... It's sha cool

I usually get annoyed at those Fiverr guys and their ridiculous pricing for this AI stuff.
Just like people charging the elderly so much just to install apps and put music on their newly bought smartphone.
Re: Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by airsaylongcome: 12:40am On Jun 13
PulsingPurple:


Na play oo 😂

Yh I know it's not self trained... Shebi it's Llama3 na... It's just this Pi stuff
Just like Indian techies will buy Arduino and program small gadgets... It's sha cool

I usually get annoyed at those Fiverr guys and their ridiculous pricing for this AI stuff.
Just like people charging the elderly so much just to install apps and put music on their newly bought smartphone.

For the Pi stuff, hmmmm make I no talk too much o. I've got several single board computers mostly Pis, Odroids and NanoPi So if I'm not messing about with Home Assistant or openHAB, I'm running a router(openwrt) or a PBX or something esoteric.

2 Likes

Re: Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by danielclerkson(m): 3:46am On Jun 13
turmacs:
Wow this is actually correct and I am really surprised that it could solve it (although this a very easy problem). Chatgpt just solved nonsense. So no software engineer on NL could solve this till now? wonderfull.
Please, break down the question and answer so that we the entry level devs can learn. Thanks
Re: Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by tosinhtml: 8:28am On Jun 13
turmacs:

Let us see those that are real programmers smiley



So DevDevDev is no longer anonymous? She has finally showed us her real account grin grin grin
Re: Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by turmacs(f): 8:30am On Jun 13
tosinhtml:



So DevDevDev is no longer anonymous? She has finally showed us her real account grin grin grin
Who is this DevDevDev abeg? undecided the other guy say na TastedFriedPussy... Na wa ohh.
Re: Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by Shomek(m): 8:50pm On Jun 13
airsaylongcome:

[code] #include <iostream> #include <vector>
using namespace std;
pair<int, int> findCircleCenter(int n, int m, vector<string>& grid) { int rowSum = 0, colSum = 0, count = 0;
for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { if (grid[i][j] == '#') { rowSum += i + 1; colSum += j + 1; count++; } } }
int centerRow = (rowSum + count - 1) / count; int centerCol = (colSum + count - 1) / count;
return make_pair(centerRow, centerCol); }
int main() { int t; cout << "Enter the number of test cases: "; cin >> t;
while (t--) { int n, m; cout << "Enter the dimensions of the grid (n m): "; cin >> n >> m;
vector<string> grid(n); cout << "Enter the grid (each row on a new line):\n";
nice one sir
Re: Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by Paystack: 11:09pm On Jun 13
turmacs:
Wow this is actually correct and I am really surprised that it could solve it (although this a very easy problem). Chatgpt just solved nonsense. So no software engineer on NL could solve this till now? wonderfull.
Mad woman.

How much are you paying... you have gone to solve it with ChatGpt and it couldn't solve it for you after all your trials you yourself couldn't solve it.

I know you went to Google and get the answer somewhere then brought the question here to console yourself thinking everyone is dumb like you.

No one self should waste time trying to solve it for you as you just want to ridicule people and console yourself instead of learning.

Fork u!
Re: Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by MindHacker9009(m): 3:37am On Jun 14
turmacs:
Wow this is actually correct and I am really surprised that it could solve it (although this a very easy problem). Chatgpt just solved nonsense. So no software engineer on NL could solve this till now? wonderfull.

Software Engineers on NL will not waste their valuable time on such a tasks that lack commercial viability. Such tasks you posted from Leetcode are typically more suited for university mathematics students who are learning to apply programming to solve their mathematical exercises.

Here is an example of what Software Engineers on NL will spend their valuable time on:

Implement a piece of online software suitable for use by a cinema. The system should be
capable of providing information about films currently showing, and of the availability
of seats in the cinema. The system should allow for seats to be booked either
individually or as a block. For example a block of 3 seats would require 3 adjacent
seats to be booked together.

3 Likes

Re: Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by danielclerkson(m): 4:34am On Jun 14
MindHacker9009:


Software Engineers on NL will not waste their valuable time on such a tasks that lack commercial viability. Such tasks you posted are typically more suited for university mathematics students who are learning to apply programming to solve their mathematical exercises.

Here is an example of what Software Engineers on NL will spend their valuable time on:

Implement a piece of online software suitable for use by a cinema. The system should be
capable of providing information about films currently showing, and of the availability
of seats in the cinema. The system should allow for seats to be booked either
individually or as a block. For example a block of 3 seats would require 3 adjacent
seats to be booked together.
Along with the front end ?
Re: Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by MindHacker9009(m): 4:38am On Jun 14
danielclerkson:

Along with the front end ?

Yeah with the front-end.
Re: Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by danielclerkson(m): 4:46am On Jun 14
MindHacker9009:


Yeah with the front-end.
The main back end gra-gra is checking if a seat has been booked, because only js will do the info of movie (using an API) but you can also use js all through, just store the seating info on the local disc
Re: Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by MindHacker9009(m): 5:03am On Jun 14
danielclerkson:

The main back end gra-gra is checking if a seat has been booked, because only js will do the info of movie (using an API) but you can also use js all through, just store the seating info on the local disc

The main part is checking all the rows to see if 3 adjacent seats are available to be booked.

Re: Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by danielclerkson(m): 5:09am On Jun 14
MindHacker9009:


The main part is checking all the rows to see if 3 adjacent seats are available to be booked.
The individuals data will be linked to a specific number or code. These codes have designated seats based on bookings. If the code has 3 consecutive seats, it is now a block. (a while loop will work)
Re: Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by turmacs(f): 7:08am On Jun 14
Paystack:

Mad woman.

How much are you paying... you have gone to solve it with ChatGpt and it couldn't solve it for you after all your trials you yourself couldn't solve it.

I know you went to Google and get the answer somewhere then brought the question here to console yourself thinking everyone is dumb like you.

No one self should waste time trying to solve it for you as you just want to ridicule people and console yourself instead of learning.

Fork u!
Look at this one grin Such a pained soul, all these self taught people sef. Before I posted the problem, i know I'll find dumb devs who can not solve the simple problem but will use "how much" as an excuse to escape reality. You're dumb be say you're dumb, all these long talk no necessary.
Re: Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by turmacs(f): 7:14am On Jun 14
MindHacker9009:


Software Engineers on NL will not waste their valuable time on such a tasks that lack commercial viability. Such tasks you posted are typically more suited for university mathematics students who are learning to apply programming to solve their mathematical exercises.

Here is an example of what Software Engineers on NL will spend their valuable time on:

Implement a piece of online software suitable for use by a cinema. The system should be
capable of providing information about films currently showing, and of the availability
of seats in the cinema. The system should allow for seats to be booked either
individually or as a block. For example a block of 3 seats would require 3 adjacent
seats to be booked together.
Bro please keep quiet, you always talk reason like what i don't know. You could not solve it be say you could not solve it, this is a leetcode style problem so you're telling me it's university students that should be doing leetcode? Okay when you get to your next interview and they give you leetcode style problem, tell them that one. You will not waste time to solve a simple problem that would not take more than 15 LOC to solve, but you have time to type all this gibberish? Ohh please grin I've always known you to shy away from anything that has to do with any form of critical thinking so I'm not surprised here. The other day i posted a simple math problem, na still this you gibbering you use as excuse.
Re: Let us see the real programmers. Not Every Time Here Frontend, Backend, React. by turmacs(f): 7:37am On Jun 14
For those that might be interested in how to think about the solution....

First of all you need to understand that this problem is not as mathematical as some might have thought, because I assumed that after reading the second paragraph some people who are not math inclined will lose hope, it's just pure implementation problem with very very little math, basically just addition and subtraction. I don't know what that MindHacker9009 guy is saying, university mathematics students grin Lolzz.. A child in jss1who knows how to code should be able to solve this with little effort.

You have to observe that the points that are part of the circle are always in a diamond shape and are symmetrical from the middle column.
All you have to do is to find the first appearance of '#' character because the first appearance will always be the on the same column as the center of the circle ( the row and column that it's found on) and to find the row that the center appears on, just count the number of '#' in the middle column, divide that count by 2 (to find the position of the middle) then add whatever you get to the row number that the first '#' was on.

Sorry if my explanation is hard to understand by here is my C++ solution to the problem, you can use chatgpt to convert to any language of your choice to understand it.


#include <vector>
#include <iostream>
using namespace std;
void paveway(){
long long n , m; cin >> n >> m; long long ans = 0, cnt = 0;bool ant = false;
vector<vector<char>> a(n , vector<char>(m));long long anc = 0;
for(long long i = 0; i < n; i++){
for(long long j = 0; j < m; j++){
cin >> a[i][j];
if(a[i][j] == '#' && ant == false){
ans = j + 1 , anc = i + 1; ant = true; // This is where we find the row and column of the first ever '#'
}
if(a[i][j] == '#' && j == ans - 1) cnt += 1; // This keep's count of the number of '#' on the middle column
}
}
cout << cnt/2 + anc << " " << ans << endl;
}
int main (){
ios::sync_with_stdio(false);
cin.tie(nullptr);
//long long t = 1;
long long t; cin >> t;
for( ;t--; )
paveway();
return 0;
}

1 Like

(1) (2) (Reply)

Free: Scbcd 5.0 Beta Certification Exam / Learning Ruby / Vb Concepts

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 86
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.