Skip to content

socratesmb/challenge_code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

challenge_code

This code is for challenge of programing

Execution Instructions

Note: The code is made in python, in case you don't have it you can download it from => Python, the repository contains the following:

Main Code (01_find_numbers)

This is the main code of the challenge, follow these steps:

  1. In the document 01_find_numbers.py. This is the code requested in the test.

  2. The code requires two inputs per console:

    • The first input is to enter a text string containing the numbers separated by commas.
    • The second input is to enter the target number.
  3. I know that one of the requirements was that the code be less than 20 lines, but I like to comment out the code.

Reading Numbers from a File (02_file_find_numbers)

I decided to go a little further and try reading numbers from an external document, since the exercise mentioned it, why not try it, follow these steps:

  1. In the document 02_file_find_numbers.py. There is the code where it reads an external document.

  2. There is also a file in .txt format, for this example numbers.txt that has a list of 10 thousand random numbers (positive and negative) between 1000 and -1000.

  3. Additionally the code will request as input the target number.

  4. In addition, the code includes a time function to measure the execution time and verify if it meets the requirement to execute in a time better than O(n^2).

Postsdata: I didn't understand the code for the first 15 minutes, and I decided to honestly look for help on ChatGPT, once I understood it I decided to run the code. Looking for help to optimize it with ChatGPT.


Instrucciones de Ejecución

Nota: El codigo esta echo en python, en caso de no tenerlo puedes descargarlo de => Python, el repositorio contiene lo siguiente:

Código Principal (01_find_numbers)

Este es el código principal del reto, sigue estos pasos:

  1. En el documento 01_find_numbers.py. Esta el código solicitado en la prueba.

  2. El código requiere dos entradas por consola:

    • La primera entrada es para ingresar una cadena de texto que contiene los números separados por comas.
    • La segunda entrada es para ingresar el número objetivo.
  3. Se que uno de los requerimientos era que el codigo fuera en menos de 20 lineas, pero a mi me gusta comentar el codigo.

Lectura de Números desde un Archivo (02_file_find_numbers)

Decidi ir un poco mas alla y probar la lectura de números desde un documento externo, ya que en el ejercicio lo mencionada, porque no intentarlo, sigue estos pasos:

  1. En el documento 02_file_find_numbers.py. Esta el codigo donde lee un documento externo.

  2. Tambien esta un archivo en formato .txt, Para este ejemplo numbers.txt que tiene una lista de 10 mil números aleatorios (positivos y negativos) entre 1000 y -1000.

  3. Adicional el código solicitará como entrada el número objetivo.

  4. Además, el código incluye una función time para medir el tiempo de ejecución y verificar si cumple con el requerimiento de ejecutarse en un tiempo mejor que O(n^2).

Posdata: No entendi el codigo los primero 15 minutos, y decidi honestamente buscar ayuda en ChatGPT, una vez lo entendi decidi realizar el codigo. Buscando ayuda para optimizarlo con ChatGPT.

About

This code is for challenge of programing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages