Progreso diario en LeetCode - Día 16

Diario de progreso LeetCode Day 16: resuelvo Triángulo de Pascal (#118) y Plus One (#66) con generación de filas e acarreo. Análisis de complejidad y soluciones en Python y C++, aplicadas en Q2BSTUDIO.

2 sept 2025 • 3 min read • Q2BSTUDIO Team

Inteligencia-Artificial-

Problemas resueltos: #118 Triangulo de Pascal y #66 Sumar Uno Plus One

Daily LeetCode Progress – Day 16. En esta sesion me centre en dos patrones muy utiles para retos de arrays y matematicas discretas: generacion constructiva de filas usando resultados previos y gestion correcta del acarreo al sumar digitos.

Que aprendi: en el Triangulo de Pascal cada nueva fila inicia y termina con 1 y los valores intermedios se obtienen sumando los dos elementos superiores inmediatos. Esto permite construir el triangulo de forma iterativa en tiempo cuadratico respecto al numero de filas y espacio similar. Para Plus One, convertir la lista de digitos a entero puede ser comodo en lenguajes con enteros arbitrarios, pero en C++ es mas seguro y escalable simular la suma con acarreo recorriendo de derecha a izquierda. Ambos problemas refuerzan el patron de construccion iterativa con estado local fila o acarreo para resolver desafios de arrays con elegancia.

#118 Triangulo de Pascal: estrategia paso a paso. 1 iniciar con la fila base 1. 2 para cada fila i tomar la fila anterior y generar la nueva concatenando 1 mas la suma de parejas adyacentes de la fila previa y terminando con 1. 3 repetir hasta alcanzar numRows. Complejidad tiempo O numRows^2 y espacio O numRows^2, ya que almacenamos todo el triangulo. Este enfoque es directo y estable tanto en Python como en C++.

#66 Plus One: estrategia con acarreo. 1 arrancar con carry igual a 1 por el incremento. 2 recorrer el array de derecha a izquierda sumando carry al digito actual, reescribiendo el digito con sum modulo 10 y actualizando carry con sum entre 10. 3 si tras el bucle carry sigue en 1, insertar al inicio. Complejidad tiempo O n y espacio extra O 1 in-place, robusto frente a desbordamientos y escalable para listas muy grandes.

Resultados y validacion: ambas soluciones pasaron pruebas en Python y C++ con casos base como una sola fila, arrays que generan nuevo digito por ejemplo 9 9 9 mas 1 y tamaños intermedios. El enfoque iterativo evita estructuras complejas y facilita la razonabilidad del codigo.

Como lo aplicamos en Q2BSTUDIO: en nuestra empresa de desarrollo Q2BSTUDIO aplicamos estos mismos principios para construir soluciones solidas y eficientes, desde aplicaciones a medida y software a medida hasta sistemas con inteligencia artificial y ciberseguridad, integrando servicios cloud aws y azure, servicios inteligencia de negocio y power bi. Si tu empresa busca ia para empresas con agentes IA productivos y escalables, consulta nuestro servicio de inteligencia artificial. Y si necesitas plataformas robustas y mantenibles, descubre nuestro enfoque de desarrollo de software y aplicaciones multiplataforma.

Breve recordatorio de complejidad: Triangulo de Pascal tiempo cuadratico en numero de filas y espacio cuadratico. Plus One tiempo lineal en longitud de los digitos y espacio extra constante.

Proximo paso: sigo resolviendo y documentando a diario retos en Python y C++, desde arrays y listas enlazadas hasta programacion dinamica. Me interesa profundizar en patrones de construccion incremental, tecnicas de carry y transformaciones in-place que escalen en sistemas reales y pipelines de datos analiticos con power bi y servicios inteligencia de negocio.

Sigamos en contacto: puedes ver mi progreso y comentarios tecnicos en LinkedIn y revisar el repositorio de la serie en GitHub. Perfil de LinkedIn Serie en GitHub

Palabras clave: aplicaciones a medida, software a medida, inteligencia artificial, ia para empresas, agentes IA, ciberseguridad, servicios cloud aws y azure, servicios inteligencia de negocio, power bi.

A BREAK?

Play for a moment before you go

OUR SERVICES

How we can help you

Artificial intelligence

AI agents, chatbots, and intelligent assistants that automate tasks and serve your customers 24/7 to improve the efficiency of your business.

More info

Software Development

Web, mobile, and desktop applications, intranets, e-commerce, SaaS, and management platforms designed for your company's specific needs.

More info

Cloud services

Migration, infrastructure, managed hosting, high availability, and security on Microsoft Azure and Amazon Web Services to help your business scale without limits.

More info

Cybersecurity and pentesting

Security audits, penetration testing and protection of applications, data and infrastructure on-premise and cloud, with ethical hacking and regulatory compliance.

More info

Business Intelligence

Dashboards and data analysis with Power BI: we integrate your sources, design dashboards and KPIs and turn your data into decisions.

More info

Process automation

We automate repetitive tasks and connect your applications with n8n, Power Automate, Make, and RPA, eliminating manual work and increasing productivity.

More info

Training for Companies

We train your teams in technology with criteria: web development, databases, Git, best practices and security, automation with n8n, artificial intelligence for companies and creation of AI solutions with Azure AI Foundry.

More info

Code Auditing

We audit the code that you, your team or an AI create: we tell you what is good and what to improve, we secure it and make it ready for production, web or app.

More info

AI Image Generation

We create for you the images that your business needs with artificial intelligence: product, networks, advertising, illustration and avatars. You tell us what you want and we deliver it ready to use.

More info

AI Video Generation

We create videos with artificial intelligence for you: promotional, networking, virtual presenters, dubbing and animations. You tell us the idea and we will deliver it assembled and ready to publish.

More info

AI Conversational Avatars

We create conversational avatars with AI – digital humans with a face and voice – that serve your customers and teams with the knowledge of your company, on your website, interactive monitors, WhatsApp or Teams.

More info

Online Marketing and AI

Google Ads, Meta Ads, LinkedIn Ads and AI Engine Positioning (GEO/AEO): we attract customers and make your brand appear where they search for you, also on ChatGPT, Gemini and Perplexity.

More info

Do you have a project in mind?

Tell us your vision and we'll turn it into a software solution. Whatever the scope, we make your idea real.

Live Chat