Questions tagged [algorithm]

An algorithm is a sequence of well-defined steps that define an abstract solution to a problem. Use this tag when your issue is related to algorithm design.

Filter by
Sorted by
Tagged with
2
votes
2answers
49 views

LeetCode 8: String to Integer (atoi)

I'm posting a solution for LeetCode's "String to Integer (atoi)". If you'd like to review, please do. Thank you! Problem Implement atoi which converts a string to an integer. The function ...
2
votes
0answers
22 views

Gradient descent algorithm for solving localization problem in 3-dimensional space

Task This code accomplishes the Time Difference of Arrival (TDoA) multilateration problem (see) using gradient descent (known otherwise as steepest descent). Goal I'm looking to: a) Improve speed: In ...
4
votes
1answer
76 views

Product of all but one number in a sequence - Follow Up (2)

This code is a improved version of implementation which asked for a review: Product of all but one number in a sequence. ...
-1
votes
1answer
71 views

Optimizing algorithm for constructing a string given costs to operations [closed]

I'm doing the following problem (not homework): I'm doing an exercise (not homework) and I decided to go with backtracking, The problem says as follows: You are given as input a target string. ...
2
votes
2answers
53 views

Lowest Common Ancestor in Binary Tree (Iterative)

In the below code I've implemented a method to find the lowest common ancestor of a binary tree. This is an iterative approach using this pseudocode. Please suggest any improvements that can be made. <...
2
votes
2answers
138 views

LeetCode 665: Non-decreasing Array (C)

I'm posting a solution for LeetCode's "Non-decreasing Array". If you'd like to review, please do. Thank you! Problem Given an array nums with ...
2
votes
1answer
27 views

LeetCode 665: Non-decreasing Array

I'm posting a solution for LeetCode's "Non-decreasing Array". If you'd like to review, please do. Thank you! Problem Given an array nums with ...
-1
votes
2answers
83 views

Find the minimum value in an array

I am completing a simple but tedious program in C++. I have a function that must find the minimum value in an array. Here is the code: ...
5
votes
1answer
64 views

LeetCode 1638: Count Substrings That Differ by One Character

I'm posting a solution for LeetCode's "Count Substrings That Differ by One Character". If you'd like to review, please do. Thank you! Problem Given two strings s and t, find the number of ...
5
votes
1answer
45 views

Job Scheduling Algorithm

Changed Program based on suggestions. New Code: Job Scheduling Algorithm 2 I have created an algorithm for job scheduling. The algorithm goes through sub-lists in order with two nested for loops. ...
5
votes
4answers
128 views

String concatenation challange to be more efficient with DayOfWeek and Lists

I have this challange that I finished which asked to print out a string according to the provided schedule. Here is an example: ...
3
votes
1answer
54 views

Is there a way to make this code simplier?

Program description: Given an array of integers nums and an integer target, return indices of the two numbers such that they ...
3
votes
1answer
81 views

LeetCode - Weekly Contest 213 - Kth Smallest Instructions

Hi I participated in Leetcode weekly contest 213 and am facing issue with submission for below question Kth Smallest Instructions Bob is standing at cell (0, 0), and he wants to reach destination: (...
7
votes
2answers
232 views

Splitting an integer to its digits

I want to split an integer of type unsigned long long to its digits. Any comments and suggestions are always welcome. ...
0
votes
0answers
50 views

Minimum number of jumps required [closed]

Saw this question while going through some String interview questions. I was not able to execute this since I was getting a Time Limit Exception on the website (Geeks for Geeks). I tried couple of ...

15 30 50 per page
1
2 3 4 5
301