Day 66 of 360 π
Today I focused on solving two interesting problems and delved into DevOps and Cloud concepts. Hereβs a detailed overview of my learning:
Problem 1: 74. Search a 2D Matrix
Approach: To efficiently search in a 2D matrix where each row is sorted and the first element of each row is greater than the last element of the previous row, I used the following approach:
Treat the 2D matrix as a 1D array.
Use binary search to find the element.
Convert the 1D array index back to 2D matrix indices.
This approach ensures a time complexity of O(log(m * n)) where m and n are the dimensions of the matrix.
Problem 2: Find the Quotient
Problem Statement: Find the quotient of two integers without using division (/) and modulus (%) operators, aiming for a time complexity of O(log n) and constant space.
Approach: To solve this problem, I used the following strategy:
Implement binary search to find the quotient.
Use the store and compute strategy to keep track of the results.
Adjust the search space based on the current middle value and continue the search until the quotient is found.
This approach efficiently computes the quotient using logarithmic time complexity.
DevOps and Cloud Learning π
Today, I explored the concepts of Terraform and Ansible:
Terraform:
Overview: Terraform is an open-source infrastructure as code software tool created by HashiCorp. It enables users to define and provision data center infrastructure using a high-level configuration language.
How it Works: Users write configuration files to define the desired state of their infrastructure. Terraform then generates an execution plan describing what it will do to reach the desired state, and then it executes the plan to build the infrastructure.
Ansible:
Overview: Ansible is an open-source automation tool, or platform, used for IT tasks such as configuration management, application deployment, intraservice orchestration, and provisioning.
How it Works: Ansible works by connecting to your nodes and pushing out small programs, called Ansible modules, to them. It then executes these modules and removes them when done. The management node runs the Ansible automation engine, which in turn connects to the nodes via SSH and executes the required tasks.
Infrastructure as Code (IaC):
Concept: Infrastructure as Code (IaC) is the process of managing and provisioning computing infrastructure through machine-readable definition files, rather than physical hardware configuration or interactive configuration tools.
Benefits: IaC allows for consistent and repeatable configurations, reduces the chances of human error, enhances disaster recovery, and speeds up the deployment process.
It was an enriching day filled with problem-solving and expanding my knowledge in DevOps and Cloud technologies. Looking forward to implementing these concepts in real-world scenarios!
Feel free to share your thoughts, questions, or feedback. Happy coding and learning! π
Subscribe to my newsletter
Read articles from Prashant Joshi directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Prashant Joshi
Prashant Joshi
Fuelled by boundless passion for DevOps and cloud technologies βοΈβοΈβοΈ βοΈ, I'm on an exhilarating journey of mastery of Computer Application (MCA). I'm not just learning; I'm devouring DevOps principles and cloud tech, crafting the future through relentless innovation and automation. π