본문 바로가기

IT/[Everyday]Coding39

Jewels and Stones You're given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to know how many of the stones you have are also jewels.The letters in J are guaranteed distinct, and all characters in J and S are letters. Letters are case sensitive, so "a" is considered a different type of stone from "A".Ex.. 2019. 1. 22.
노트북 밧데리 수명 예측 연습 노트북 밧데리 수명 로그를 보고 수명을 예측하는 파이썬 코드 “trainingdata.txt” 라는 training file이 주어진다. 이 파일 안에는 100개의 정보가 있다. [충전 시간, 밧데리 수명 시간] 예를 들어, 2.81,5.62 7.14,8.00 2.72,5.44 3.87,7.74 1.90,3.80 5.50,8.00 0.14,0.28 2.00,4.00 1.78,3.56 3.45,6.90 ... 문제는 쉽다. training data를 보고 밧데리 수명을 예측하자. input으로 충전 시간이 들어온다. output으로 예측되는 수명시간을 출력하면 된다. 예를들어, Input: 0.15 Output: 3.00 *방법: 두 가지 조건이 있으니 .. 쉽게 할 수 있고 생각이 난게 Linear Re.. 2018. 2. 20.
이진트리 높이 탐색 이진트리의 높이를 구해보자. #이진트리를 구성하는 노드 class Node: def __init__(self,data): self.right=self.left=None self.data = data #이진트리 설계 class Solution: def insert(self,root,data): if root==None: return Node(data) else: if data 2018. 2. 20.
이진트리 모든 데이터 탐색 이진트리의 모든 데이터릍 탐색하여 출력한다. 루트-Left-Right 순서로 내려간다. import sys class Node: def __init__(self,data): self.right=self.left=None self.data = data class Solution: def insert(self,root,data): if root==None: return Node(data) else: if data 2018. 2. 20.
반응형