Skip to content

Instantly share code, notes, and snippets.

View fpdjsns's full-sized avatar
😄
인생의 풍류를 즐기는 중

withham fpdjsns

😄
인생의 풍류를 즐기는 중
View GitHub Profile
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
class Main {
class Solution {
private:
int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, -1, 1};
public:
int getAnswer(int x, int y, vector<vector<int>>& A){
int r = A.size();
int c = A[0].size();
class Solution {
public:
int maxScoreSightseeingPair(vector<int>& A) {
int l = 0, r = 0;
int answer = -1e5;
for(int r=1; r<A.size(); r++){
answer =max(answer, A[l] + A[r] + l - r);
if(A[l] <= A[r] + r - l)
l = r;
}
class Solution {
public:
int shipWithinDays(vector<int>& weights, int D) {
// find minimum weights can Answer
int l = 0;
int r = 0;
for(int i=0;i<weights.size();i++){
int nowWeight = weights[i];
l = max(l, nowWeight);
r += nowWeight;
class Solution {
public:
int numPairsDivisibleBy60(vector<int>& time) {
map<int, int> m;
int answer = 0;
for(int i=0;i<time.size();i++){
int rest = time[i] % 60;
m[rest]++;
}
for(map<int,int>::iterator it = m.begin(); it != m.end(); it++){
class Solution {
public:
int bitwiseComplement(int N) {
if(N == 0) return 1;
int tmp = 1;
int answer = 0;
while(0 < N){
answer += ((N + 1) % 2) * tmp;
N /= 2;
tmp *= 2;
class Solution {
public:
int largestSumAfterKNegations(vector<int>& A, int K) {
sort(A.begin(), A.end());
int answer = 0;
int lastMinus = 1e9;
for(int i=0;i<A.size();i++){
if(A[i] < 0){
if(0 < K){
A[i] *= -1; K--;
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
//
// Created by fpdjsns
// Copyright © 2019 fpdjsns. All rights reserved.
//
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>