DSA - Merge Sorted Array Problem

Introduction In the previous chapter, we discussed Data Structures and Algorithms, delved into an overview of Dynamic Arrays, and solved the “Remove Element” problem. In this article, I’m going to show one of the ways to solve the 88. Merge Sorted Array problem. Problem You are given two integer arrays, nums1 and nums2, sorted in non-decreasing order, and two integers, m and n, representing the number of elements in nums1 and nums2, respectively. Merge nums1 and nums2 into a single array sorted in non-decreasing order. The final sorted array should not be returned by the function but should instead be stored inside the array nums1. To accommodate this, nums1 has a length of m + n, where the first m elements denote the elements that should be merged, and the last n elements are set to 0 and should be ignored. nums2 has a length of n. ...

August 15, 2024 · 3 min · Dmytro Chumakov

Data Structures and Algorithms Arrays Swift

Introduction I’ve always been curious about data structures and algorithms, and how they can improve user experiences while saving money for businesses through optimized computations. In this series of articles, I’m going to solve LeetCode problems and share my approach with you. I’ve just started my journey in solving LeetCode problems, so my solutions might not be as efficient as they could be, but I’m always looking for improvement. Before each topic, I’ll provide a brief introduction to the data structure, algorithm, or technique I’ll be using to solve a specific problem. ...

August 12, 2024 · 3 min · Dmytro Chumakov

Implementing HealthKit in an iOS App

Introduction Previously, I worked with a healthcare app that used the HealthKit framework, but I did not get the opportunity to implement it myself. I decided to look into it and share what I found. In this article, I will focus on the steps to integrate HealthKit, write, and access its data. Preparation Before we dive into implementation, I assume that you have an active Apple Developer account; without it, you will not be able to access the HealthKit Store. Let’s add: ...

July 26, 2024 · 4 min · Dmytro Chumakov

Implementing Location Service

Introduction Nowadays, location is an essential feature in almost every application. It’s very important to know the best ways to implement it without affecting performance and user experience. In this article, I will focus on how to implement general methods in location service. Preparation Before we begin, let’s add location permission keys to Info.plist: Privacy - Location When In Use Usage Description Privacy - Location Always and When In Use Usage Description First Step The first step is to create LocationService with the requestPermissions method to be able to receive location events. ...

July 23, 2024 · 3 min · Dmytro Chumakov

Implementing ChatGPT in an iOS App

Introduction I haven’t had the opportunity to build a chatbot before. This topic was trending some time ago, and I always wanted to implement it myself. In this article, I will focus on the steps you need to know to successfully build and run a chatbot application. First Step The first step is to add the OpenAI dependency to your project: .package(url: "https://github.com/MacPaw/OpenAI.git", branch: "main") dependencies: [ .byNameItem( name: "OpenAI", condition: .when(platforms: [ .iOS, ]) ), ], Second Step The second step is to generate an OpenAI key and replace it inside your project. ...

July 21, 2024 · 2 min · Dmytro Chumakov