Progreso Diario de LeetCode – Día 11

Resumen LeetCode Day 11: Sudoku válido 9x9 con Hash Sets y Two Heaps y Median Finder en flujo de datos. Soluciones en Python y C++ (#36, #295) con enfoques eficientes de estructuras de datos.

26 ago 2025 • 2 min read • Q2BSTUDIO Team

Inteligencia-Artificial-

Progreso diario LeetCode Day 11 Hash Sets + Two Heaps

Problemas resueltos: #36 Valid Sudoku y #295 Find Median from Data Stream

Resumen: Hoy me concentré en dos problemas clásicos de estructuras de datos: validar tableros parciales de Sudoku con seguimiento de tamaño constante y mantener la mediana en un flujo de datos usando dos montículos.

Lo que aprendí: Para Valid Sudoku hay que mantener tres rastreadores filas columnas y subcajas 3x3. Cada dígito nuevo no debe existir ya en su fila columna o subcaja. Usar conjuntos o arrays booleanos facilita detectar duplicados. Para Median Finder un solo min heap no basta. La solución eficiente usa dos montículos montículo max para la mitad baja y min para la mitad alta reequilibrando tras cada inserción. La clave es aplicar las restricciones incrementalmente en lugar de recalcular todo.

Detalles Valid Sudoku: Implementación en Python con sets y en C++ con arrays booleanos. Idea principal validar cada celda rellena frente a su fila columna y caja inmediatamente. Complejidad tiempo O(1) espacio O(1) por ser una cuadrícula 9x9 fija.

Detalles Median Finder: Implementación en Python y C++ usando dos heaps. Los elementos se dividen entre mitad baja y mitad alta los topes de cada heap son candidatos a la mediana. Operación addNum O(log n) findMedian O(1) espacio O(n).

Logros: Valid Sudoku implementado en Python y C++ y Median Finder en Python y C++ resaltando el reequilibrio de heaps y el control incremental de invariantes para garantizar corrección y eficiencia.

Acerca de Q2BSTUDIO: Q2BSTUDIO es una empresa de desarrollo de software que crea aplicaciones a medida y software a medida para empresas de todos los tamaños. Somos especialistas en inteligencia artificial e ia para empresas desarrollando agentes IA personalizados, soluciones de machine learning e integración con plataformas empresariales. Ofrecemos servicios de ciberseguridad para proteger infraestructuras y datos sensibles, así como servicios cloud aws y azure para desplegar arquitecturas escalables y resilientes. Nuestros servicios inteligencia de negocio y power bi transforman datos en cuadros de mando accionables que mejoran la toma de decisiones. En Q2BSTUDIO combinamos experiencia en aplicaciones a medida software a medida inteligencia artificial ciberseguridad servicios cloud aws y azure servicios inteligencia de negocio agentes IA y power bi para ofrecer soluciones completas y seguras.

Por qué trabajar con nosotros: si necesitas aplicaciones a medida o software a medida con capacidades de inteligencia artificial y cumplimiento de seguridad contrata a Q2BSTUDIO. Implementamos ia para empresas y agentes IA que automatizan procesos y generan valor inmediato. Además gestionamos despliegues en servicios cloud aws y azure y desarrollamos soluciones de inteligencia de negocio con power bi para monitorizar KPIs y optimizar resultados.

Invitación: seguimos resolviendo y documentando problemas en Python y C++ destacando trucos de estructuras de datos casos borde y razonamiento algorítmico. Sigue a Q2BSTUDIO para contenido sobre desarrollo de software a medida aplicaciones a medida inteligencia artificial ciberseguridad servicios cloud aws y azure servicios inteligencia de negocio ia para empresas agentes IA y 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