Dev_
- [handlebars] if문 2018.05.10
- [jQuery] 테이블 데이터 접근 2018.05.10
- 1.웹브라우저의 메세지 작성 2018.02.13
- HackerRank : Sherlock and Array 2018.01.10
- HackerRank : Permuting Two Arrays 2018.01.09
[handlebars] if문
[jQuery] 테이블 데이터 접근
1.웹브라우저의 메세지 작성
1. HTTP 리퀘스트 메세지를 작성한다
웹 브라우저는 URL을 해독하여 리퀘스트 메세지를 만듬
http:// + 웹 서버명 + 데이터 출저(파일) 경로명
(즉, 어디에 엑세스해야 하는지 판명)
웹 브라우저는 이 리퀘스트 메세지에 따라 웹 서버에 무엇을 하려는지 전달
리퀘스트 메세지 : 무엇을(URI) + 어떻게해서(메소드)
(리퀘스트 메세지에 쓰는 URL은 하나뿐으로, 복수의 파일을 일을 때는 웹 서버에 별도의 리퀘스트 메세지를 보낸다)
2. 웹 서버의 IP주소를 DNS서버에 조회한다
HackerRank : Sherlock and Array
Sherlock and Array
Watson gives Sherlock an array of length . Then he asks him to determine if there exists an element in the array such that the sum of the elements on its left is equal to the sum of the elements on its right. If there are no elements to the left/right, then the sum is considered to be zero.
Formally, find an , such that, .
Input Format
The first line contains , the number of test cases. For each test case, the first line contains , the number of elements in the array . The second line for each test case contains space-separated integers, denoting the array .
Constraints
Output Format
For each test case print YES
if there exists an element in the array, such that the sum of the elements on its left is equal to the sum of the elements on its right; otherwise print NO
.
Sample Input 0
2
3
1 2 3
4
1 2 3 3
Sample Output 0
NO
YES
Explanation 0
For the first test case, no such index exists.
For the second test case, , therefore index satisfies the given conditions.
HackerRank : Permuting Two Arrays
Permuting Two Arrays
Consider two -element arrays of integers, and . You want to permute them into some and such that the relation holds for all where . For example, if , , and , a valid satisfying our relation would be and .
You are given queries consisting of , , and . For each query, print YES
on a new line if some permutations , exist satisfying the relation above. If no valid permutations exist, print NO
instead.
Input Format
The first line contains an integer, , denoting the number of queries. The subsequent lines describe each of the queries in the following format:
- The first line contains two space-separated integers describing the respective values of (the size of arrays and ) and (the relation variable).
- The second line contains space-separated integers describing the respective elements of array .
- The third line contains space-separated integers describing the respective elements of array .
Constraints
Output Format
For each query, print YES
on a new line if valid permutations exist; otherwise, print NO
.
Sample Input
2
3 10
2 1 3
7 8 9
4 5
1 2 2 1
3 3 3 4
Sample Output
YES
NO
Explanation
We perform the following two queries:
, , and . We permute these into and so that the following statements are true:
Thus, we print
YES
on a new line.- , , and . To permute and into a valid and , we would need at least three numbers in to be greater than ; as this is not the case, we print
NO
on a new line.