algorithm tag

168 questions


1 answers
109 views
0
[Data structure] I want to know the actual use of the queue and stack!!

Hello! I am personally studying algorithms and data structures through studiesFor list, such as single linked list, double linked list, etc. I can understand why it is implemented differently even tho...


2 answers
76 views
0
A simple algorithmic question! (Check if it is the same character pair)

Hello! It's a simple question. Hmm... I don't know what to do with the algorithmI'm trying to get two strings from the user and check if they're the sameFor example, even if the string is flipped, the...


1 answers
42 views
0
Find the center of gravity coordinates of different coordinates (polygons) on the map

Currently, we are trying to draw a polygon with javascript through the following map api and find the center point of that polygon.I've done drawing a polygon.I'm struggling to find the center point o...

2 years ago

1 answers
38 views
0
An algorithmic question to find the closest point among the points.

The execution environment uses the GCC compiler through Bash.We're going to create a program to find the distance between two of the 16 points that are closest to each other.#include <stdio.h>#i...

2 years ago

1 answers
42 views
0
Question about Java continuous number acquisition algorithm.

import java.util.Scanner;public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); in.close(); int sum = 0, max = 0; while (n >...

2 years ago

1 answers
44 views
0
Why is the time complexity O(V+E) in depth-first search of graphs implemented as linked lists?

A / | \ B | D -- E \ | / | C ------+If you have a graph implemented as a linked list, you must call the DFS function n times to visit n vertices, and each call must move between nodes in the lin...

2 years ago

2 answers
60 views
0
Java Problems: Building a Number Pyramid

Hello, I'm asking you a question because I didn't like my code while doing my assignment.The questions you gave me are as follows.Develop a JAVA-program that does the following job: Your program shall...

2 years ago

1 answers
82 views
0
I don't like the same number. It's an example question.

import java.util.*;public class Solution { public int[] solution(int []arr) { int[] ans = new int[100]; int cur=arr[0]; int j=0; for(int i=1;i<arr.length;i++){ if(cur!=arr[i]){ ans[j]=cur; ...

2 years ago

1 answers
44 views
0
[Python3] I woven a code using a bit mask and recursion, but I don't know why the output value doesn't come out.

The problem I'm solving right now is Exporter Tour in Baekjun Online Jersey #2098. I know that the most common way to solve this problem is through bitmask and dynamic programming. I planned it like t...


1 answers
41 views
0
Can anyone explain why the answer to the Hackerrank algorithm question is this?

https://www.hackerrank.com/challenges/java-output-formatting/problemThe problem link is above.import java.util.Scanner;public class Solution { public static void main(String[] args) { Scanner sc=new ...

2 years ago
« - 13 - »

© 2024 OneMinuteCode. All rights reserved.