전체 108

[수치해석] Gauss Elimination을 이용한 연립 방정식 해 계산 (Python)

어떤 연립방정식이 다음과 같이 주어졌을 때,이를 행렬의 곱 Ax = b 형태로 다음과 같이 표현할 수 있다. 위 행렬을 Gauss Elimination (가우스 소거법)을 이용하여,A를 Upper triangular matrix인 row echelon form 형태로 정리하면 연립방정식의 해를 얻을 수 있다. 그 과정은 다음과 같다.1. Pivoting : 기준이 되는 각 행의 첫 요소가 가장 큰 절댓값을 가지도록 행을 변경하는 과정기준 행인 1행의 첫 요소가 가장 큰 절댓값을 갖도록 행을 바꾸어준다. 2. Forward Elimination : Pivot이 설정된 기준 행과 열에 대하여 기준 행을 제외한 기준 열의 요소를 0으로 정리한다.위 1, 2 과정을 Upper Triangular matrix (..

[LeetCode] 28. Find the Index of the First Occurrence in a String (Medium/Python)

Find the Index of the First Occurrence in a String - LeetCode Can you solve this real interview question? Find the Index of the First Occurrence in a String - Given two strings needle and haystack, return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. Example 1: I leetcode.com Above is the link to the problem. Problem Given two strings variables..

Code/LeetCode 2023.03.03
728x90
반응형