Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

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

withham fpdjsns

😄
인생의 풍류를 즐기는 중
View GitHub Profile
@fpdjsns
fpdjsns / LDS.cc
Last active July 30, 2023 06:30
LDS(Longest Decreasing Sequence). 최장 감소 수열
#include<iostream>
using namespace std;
int main()
{
int n; //입력하는 데이터 갯수
int ind = 0; //d 인덱스
int arr[1000] = { 0 };
int d[1000] = { 0 };
@fpdjsns
fpdjsns / Bubble_Sort.cc
Last active December 17, 2021 05:06
Bubble_Sort. [Input : The first line contains an integer, n, denoting the number of an array size. next line contains n space-separated integers the array data.(like 4 5 3 6 7 2 1)] [output: Print n space-separated integers the sorted array data.]
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
//swap
void swap(int &a, int &b)
{
int temp;
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#pragma warning(disable:4996)
#define MAX 100
//트리 노드
typedef struct node
{
char alphabet; //알파벳
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#pragma warning(disable:4996)
#define MAX 100
#define alph_num 26
//트리 노드
typedef struct node
{
@fpdjsns
fpdjsns / 실수 출력.cc
Last active April 18, 2020 09:44
실수 출력(정수 부분, 반올림, 올림, 내림)
#include<iostream>
using namespace std;
int main()
{
float ans, temp;
ans = 4.7777;
temp = ans;
@fpdjsns
fpdjsns / kotlin_list_groupBy.kt
Last active October 15, 2019 23:38
Kotlin list.groupBy
data class Member(val no:Long, val name: String)
fun main() {
val list = listOf(Member(1, "일"), Member(1, "이"), Member(3, "삼"))
val result = list.groupBy({it.no}, {it.name})
println(result) // {1=[일, 이], 3=[삼]}
println(result[1]) // [일, 이]
println(result[2]) // null
}
@fpdjsns
fpdjsns / c++_stl_map.cc
Created February 15, 2017 15:02
How to use map and what effect it is.
#include<iostream>
#include<map>
#include<functional>
using namespace std;
//print map element
void print(map<int, char> m)
{
//empth function
class Solution {
public:
/*
* 시간복잡도 : O(N)
*/
// sliding window
int maxSatisfied(vector<int>& customers, vector<int>& grumpy, int X) {
int l = 0;
#include <string>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
bool compare(pair<int,int>& a, pair<int,int>& b){
// 3. 장르 내에서 재생 횟수가 같은 노래 중에서는 고유 번호가 낮은 노래를 먼저 수록합니다.
if(a.first == b.first){
/**
* 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 {