본문 바로가기

Programming/Data Structure25

[Hackerrank] DeleteNode www.hackerrank.com/challenges/delete-a-node-from-a-linked-list/problem Delete a Node | HackerRank Delete a node from the linked list and return the head. www.hackerrank.com package exam.complete; //https://www.hackerrank.com/challenges/delete-a-node-from-a-linked-list/problem import exam.SinglyLinkedListNode; public class DeleteNode { static SinglyLinkedListNode deleteNode(SinglyLinkedListNode h.. 2020. 12. 2.
[Hackerrank] CompareTwoLinkedLists https://www.hackerrank.com/challenges/compare-two-linked-lists/problem Compare two linked lists | HackerRank Compare the data in two linked lists node by node to see if the lists contain identical data. www.hackerrank.com package exam.complete; //https://www.hackerrank.com/challenges/compare-two-linked-lists/problem import exam.SinglyLinkedListNode; public class CompareTwoLinkedLists { static bo.. 2020. 12. 2.
[Hackerrank] BalancedBrackets https://www.hackerrank.com/challenges/balanced-brackets/problem Arrays - DS | HackerRank Accessing and using arrays. www.hackerrank.com package exam.complete; //https://www.hackerrank.com/challenges/balanced-brackets/problem import java.util.Stack; public class BalancedBrackets { static String isBalanced(String s) { String answer = "NO"; Stack stack = new Stack(); char[] array = s.toCharArray();.. 2020. 12. 2.
[Hackerrank] reverseArray https://www.hackerrank.com/challenges/arrays-ds/problem Arrays - DS | HackerRank Accessing and using arrays. www.hackerrank.com package exam.uploaded; //https://www.hackerrank.com/challenges/arrays-ds/problem public class reverseArray { public static class Solution { // Complete the reverseArray function below. static int[] reverseArray(int[] a) { int length = a.length; int[] answer = new int[le.. 2020. 12. 2.
[Hackerrank] MaximumElement https://www.hackerrank.com/challenges/maximum-element/problemMaximum Element | HackerRankGiven three types of queries, insert an element, delete an element or find the maximum element in a stack.www.hackerrank.compackage exam.uploaded; //https://www.hackerrank.com/challenges/maximum-element/problem import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; impor.. 2020. 12. 2.
[Hackerrank] hourglassSum https://www.hackerrank.com/challenges/2d-array/problem 2D Array - DS | HackerRank How to access and use 2d-arrays. www.hackerrank.com package exam.uploaded; //https://www.hackerrank.com/challenges/2d-array/problem public class HourglassSum { public static void main(String[] args) { int[][] arr = new int[6][6]; arr = new int[][]{{-9, -9, -9, 1, 1, 1}, {0, -9, 0, 4, 3, 2}, {-9, -9, -9, 1, 2, 3}, {.. 2020. 12. 2.
[Hackerrank] BinarySearchTreeLowestCommonAncestor https://www.hackerrank.com/challenges/binary-search-tree-lowest-common-ancestor/problem Binary Search Tree : Lowest Common Ancestor | HackerRank Given two nodes of a binary search tree, find the lowest common ancestor of these two nodes. www.hackerrank.com package exam.uploaded; //https://www.hackerrank.com/challenges/binary-search-tree-lowest-common-ancestor/problem import exam.Node; import jav.. 2020. 12. 2.