Saturday, July 27, 2024
HomeGolangHello there, are you able to please assist me scripting this code?...

Hello there, are you able to please assist me scripting this code? – Code Evaluation


Specs: Write a shorter operate (phrases [] string) int that, given a slice of strings, returns the size of the shortest string by way of bytes. To check it you should utilize the primary proven within the picture under.

What have you ever tried up to now to unravel this train? What are your troubles making it work? What output do you get? Which do you count on?



1 Like

sure I begin to write it however I can’t methods to go on to unravel it

Are you able to please be extra particular? What precisely is it what you might have issues with?

As you publish some screenshot that appears as if it has been taken from a programs guide or web site, I assume you might be asking us to do your property work. We often don’t do peoples house work, however as an alternative assist them to beat their issues and subsequently resolve the train on their very own, in the end studying one thing within the course of.

Additionally normally I assume, that every little thing mandatory to unravel such an task is defined within the current coursematerial.

can I please have some advices or tricks to resolve it? I’m simply asking for these

It’s simpler to provide the ideas primarily based on what you have already got. In any other case the tipp will probably be to implement a operate that does whats requested for within the train.

Another trace we would provide you with, is likely to be one thing that you just already know. A waste of time for each of us…



1 Like

looks like it’s best to do you college assignments by your self :smile:



1 Like

Hello,

This hyperlink might enable you : https://www.golangprograms.com/golang-get-number-of-bytes-and-runes-in-a-string.html

The operate is only a loop (just like the one in your predominant() code) with a comparability to retailer the minimal worth and return that worth on the finish.
Bear in mind to initialize the worth to check with a big worth.
I’m not doing all your train… however if you happen to can’t do it with my clarification… :wink:

What are your troubles making it work?

A great tip to deal with any programming job:

Begin by writing in plain phrases, what an individual would want to do to unravel the issue – we name this pseudocode.

In case your job was to seek out the largest prime quantity in a listing it may learn like this:

Get the primary quantity within the checklist
Examine if it's a prime quantity
sure: keep in mind this quantity

Then repeat for all numbers within the checklist:
verify if the quantity is a first-rate quantity
and verify if the quantity is greater than the remembered quantity
sure: substitute the remembered quantity with the brand new one

after the checklist is full, the remembered quantity is the answer

After which you could attempt to translate every line to go code and can have an answer, which you’ll be able to take a look at and refine.



1 Like

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments