prgrms-web-devcourse / be-team-f-study2 Goto Github PK
View Code? Open in Web Editor NEW백엔드F - Tyler의 추종자들
Home Page: https://prgrms-web-devcourse.github.io/be-team-f-study2/
License: MIT License
백엔드F - Tyler의 추종자들
Home Page: https://prgrms-web-devcourse.github.io/be-team-f-study2/
License: MIT License
https://leetcode.com/problems/minimum-number-of-operations-to-move-all-balls-to-each-box/
You have n
boxes. You are given a binary string boxes
of length n
, where boxes[i]
is '0'
if the ith
box is empty, and '1'
if it contains one ball.
In one operation, you can move one ball from a box to an adjacent box. Box i
is adjacent to box j
if abs(i - j) == 1
. Note that after doing so, there may be more than one ball in some boxes.
Return an array answer
of size n
, where answer[i]
is the minimum number of operations needed to move all the balls to the ith
box.
Each answer[i]
is calculated considering the initial state of the boxes.
Example 1:
Input: boxes = "110" Output: [1,1,3] Explanation: The answer for each box is as follows: 1) First box: you will have to move one ball from the second box to the first box in one operation. 2) Second box: you will have to move one ball from the first box to the second box in one operation. 3) Third box: you will have to move one ball from the first box to the third box in two operations, and move one ball from the second box to the third box in one operation.
Example 2:
Input: boxes = "001011" Output: [11,8,5,4,3,4]
Constraints:
n == boxes.length
1 <= n <= 2000
boxes[i]
is either '0'
or '1'
._posts
폴더에 md파일을 작성하면 포스트가 자동으로 추가됩니다.파일명 예시
2021-08-10-FactoryMethod.md
tags
는 필터링(?)에 사용되므로 반드시 정해진 태그만 사용하도록 해요~
디자인패턴
, 생성패턴
, 구조패턴
, 행위패턴
<!--more-->
태그의 윗 부분은 썸네일 요약에 들어가는 부분이니까 짧게 작성해야 합니다!md 내용 예시
---
title: 팩토리 패턴에 대해 알아보자!
tags:
- 디자인패턴
- 생성패턴
---
// 짧게 설명 or 작성자 명시
<!--more-->
// 아래에서 자유롭게 작성
main
브랜치 내용만을 호스팅합니다.한재원_factory
이런식으로 하는게 어떨까요?A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.