This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use HashMap | |
class Solution { | |
public int[] relativeSortArray(int[] arr1, int[] arr2) { | |
int outputArrIndex = 0; | |
int[] tempArr = Arrays.copyOf(arr2, arr2.length); | |
Arrays.sort(arr1); | |
Arrays.sort(tempArr); | |
int[] outputArr = new int[arr1.length]; | |
HashMap<Integer, Integer> appearHashMap = new HashMap<Integer, Integer>(); | |
LinkedList<Integer> notAppearList = new LinkedList<Integer>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TC passed but TLE | |
// Need optimization | |
#include <iostream> | |
#include <stdio.h> | |
#include <algorithm> | |
#include <queue> | |
#include <iomanip> | |
using namespace std; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Sbank; | |
import java.lang.reflect.Array; | |
import java.math.BigDecimal; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Collections; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; |
NewerOlder